rpms/tar/FC-5 tar-1.14-nolibrt.patch, 1.4, 1.5 tar-1.15.1-gcc4.patch, 1.2, 1.3 tar-1.15.1-heapOverflow.patch, 1.2, 1.3 tar-1.15.1-hugeSparse.patch, NONE, 1.1 tar-1.15.1-incompatibilities.patch, NONE, 1.1 tar-1.15.1-lseek.patch, 1.2, 1.3 tar-1.15.1-makeCheck.patch, 1.3, 1.4 tar-1.15.1-newerOption.patch, 1.2, 1.3 tar-1.15.1-optionsOrder.patch, NONE, 1.1 tar-1.15.1-padCorrectly.patch, 1.2, 1.3 tar-1.15.1-permissions.patch, NONE, 1.1 tar-1.15.1-sparseTotals.patch, 1.2, 1.3 tar-1.15.1-xattrs.patch, NONE, 1.1 .cvsignore, 1.9, 1.10 sources, 1.10, 1.11 tar.spec, 1.35, 1.36 tar-1.15.91-makeCheck.patch, 1.2, NONE

fedora-cvs-commits at redhat.com fedora-cvs-commits at redhat.com
Fri Sep 29 15:41:56 UTC 2006


Author: pvrabec

Update of /cvs/dist/rpms/tar/FC-5
In directory cvs.devel.redhat.com:/tmp/cvs-serv31414

Modified Files:
	.cvsignore sources tar.spec 
Added Files:
	tar-1.14-nolibrt.patch tar-1.15.1-gcc4.patch 
	tar-1.15.1-heapOverflow.patch tar-1.15.1-hugeSparse.patch 
	tar-1.15.1-incompatibilities.patch tar-1.15.1-lseek.patch 
	tar-1.15.1-makeCheck.patch tar-1.15.1-newerOption.patch 
	tar-1.15.1-optionsOrder.patch tar-1.15.1-padCorrectly.patch 
	tar-1.15.1-permissions.patch tar-1.15.1-sparseTotals.patch 
	tar-1.15.1-xattrs.patch 
Removed Files:
	tar-1.15.91-makeCheck.patch 
Log Message:
- start new epoch, downgrade to solid stable tar-1.15.1 (#207115),
- all patches are backported


tar-1.14-nolibrt.patch:
 configure |   76 +++++++++++++++++++++++++++++++-------------------------------
 1 files changed, 38 insertions(+), 38 deletions(-)

Index: tar-1.14-nolibrt.patch
===================================================================
RCS file: tar-1.14-nolibrt.patch
diff -N tar-1.14-nolibrt.patch
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tar-1.14-nolibrt.patch	29 Sep 2006 15:41:54 -0000	1.5
@@ -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

tar-1.15.1-gcc4.patch:
 genfile.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

Index: tar-1.15.1-gcc4.patch
===================================================================
RCS file: tar-1.15.1-gcc4.patch
diff -N tar-1.15.1-gcc4.patch
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tar-1.15.1-gcc4.patch	29 Sep 2006 15:41:54 -0000	1.3
@@ -0,0 +1,16 @@
+Patch by Robert Scheck <redhat at 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[] = {

tar-1.15.1-heapOverflow.patch:
 xheader.c |   58 ++++++++++++++++++++++++++++++++++++++++++++--------------
 1 files changed, 44 insertions(+), 14 deletions(-)

Index: tar-1.15.1-heapOverflow.patch
===================================================================
RCS file: tar-1.15.1-heapOverflow.patch
diff -N tar-1.15.1-heapOverflow.patch
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tar-1.15.1-heapOverflow.patch	29 Sep 2006 15:41:54 -0000	1.3
@@ -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;
+     }
+ }

tar-1.15.1-hugeSparse.patch:
 sparse.c |  193 ++++++++++++++++++++++++++++-----------------------------------
 1 files changed, 86 insertions(+), 107 deletions(-)

--- NEW FILE tar-1.15.1-hugeSparse.patch ---
--- 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,
 };
-

tar-1.15.1-incompatibilities.patch:
 create.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletion(-)

--- NEW FILE tar-1.15.1-incompatibilities.patch ---
--- 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;

tar-1.15.1-lseek.patch:
 sparse.c |   73 ++++++++++++++++++++++++++++++++++++++++++++++++++-------------
 1 files changed, 59 insertions(+), 14 deletions(-)

Index: tar-1.15.1-lseek.patch
===================================================================
RCS file: tar-1.15.1-lseek.patch
diff -N tar-1.15.1-lseek.patch
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tar-1.15.1-lseek.patch	29 Sep 2006 15:41:54 -0000	1.3
@@ -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)

tar-1.15.1-makeCheck.patch:
 pipe.at      |    7 +++----
 testsuite.at |    4 ++--
 2 files changed, 5 insertions(+), 6 deletions(-)

Index: tar-1.15.1-makeCheck.patch
===================================================================
RCS file: tar-1.15.1-makeCheck.patch
diff -N tar-1.15.1-makeCheck.patch
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tar-1.15.1-makeCheck.patch	29 Sep 2006 15:41:54 -0000	1.4
@@ -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

tar-1.15.1-newerOption.patch:
 create.c |    2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)

Index: tar-1.15.1-newerOption.patch
===================================================================
RCS file: tar-1.15.1-newerOption.patch
diff -N tar-1.15.1-newerOption.patch
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tar-1.15.1-newerOption.patch	29 Sep 2006 15:41:54 -0000	1.3
@@ -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;

tar-1.15.1-optionsOrder.patch:
 tar.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

--- NEW FILE tar-1.15.1-optionsOrder.patch ---
--- 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;
 

tar-1.15.1-padCorrectly.patch:
 create.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

Index: tar-1.15.1-padCorrectly.patch
===================================================================
RCS file: tar-1.15.1-padCorrectly.patch
diff -N tar-1.15.1-padCorrectly.patch
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tar-1.15.1-padCorrectly.patch	29 Sep 2006 15:41:54 -0000	1.3
@@ -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;
+ 	}
+     }

tar-1.15.1-permissions.patch:
 extract.c |   19 ++++++++++++-------
 1 files changed, 12 insertions(+), 7 deletions(-)

--- NEW FILE tar-1.15.1-permissions.patch ---
--- 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,
-			  &current_stat_info.stat /* ignored */,
+			  &current_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, &current_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, &current_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, &current_stat_info.stat,
+                         0,
+                         UNKNOWN_PERMSTATUS);
+      }
       break;
 
     case GNUTYPE_VOLHDR:

tar-1.15.1-sparseTotals.patch:
 create.c |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)

Index: tar-1.15.1-sparseTotals.patch
===================================================================
RCS file: tar-1.15.1-sparseTotals.patch
diff -N tar-1.15.1-sparseTotals.patch
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tar-1.15.1-sparseTotals.patch	29 Sep 2006 15:41:54 -0000	1.3
@@ -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)

tar-1.15.1-xattrs.patch:
 src/xattrs.c                   |  402 ++++++++++++++++++++
 src/xattrs.h                   |   14 
 tar-1.15.1/Makefile.in         |   24 -
 tar-1.15.1/aclocal.m4          |  386 +++++---------------
 tar-1.15.1/config.hin          |   45 ++
 tar-1.15.1/config/config.guess |  141 ++-----
 tar-1.15.1/config/config.sub   |  111 +----
 tar-1.15.1/configure           |  790 +++++++++++++++++++++++++++++++++++++++--
 tar-1.15.1/configure.ac        |    9 
 tar-1.15.1/doc/Makefile.in     |   17 
 tar-1.15.1/doc/header.texi     |   22 +
 tar-1.15.1/doc/stamp-vti       |    4 
 tar-1.15.1/doc/tar.info        |  409 ++++++++++++---------
 tar-1.15.1/doc/tar.texi        |   47 ++
 tar-1.15.1/doc/version.texi    |    4 
 tar-1.15.1/lib/Makefile.in     |    6 
 tar-1.15.1/lib/localedir.h     |    2 
 tar-1.15.1/rmt/Makefile.in     |    9 
 tar-1.15.1/scripts/Makefile.in |   10 
 tar-1.15.1/src/Makefile.am     |    7 
 tar-1.15.1/src/Makefile.in     |   23 -
 tar-1.15.1/src/common.h        |   24 +
 tar-1.15.1/src/create.c        |   32 +
 tar-1.15.1/src/extract.c       |  114 ++++-
 tar-1.15.1/src/list.c          |    7 
 tar-1.15.1/src/misc.c          |    4 
 tar-1.15.1/src/tar.c           |   80 ++++
 tar-1.15.1/src/tar.h           |   22 +
 tar-1.15.1/src/xheader.c       |  318 +++++++++++++---
 tar-1.15.1/tests/Makefile.in   |    6 
 30 files changed, 2294 insertions(+), 795 deletions(-)

--- NEW FILE tar-1.15.1-xattrs.patch ---
diff -rup tar-1.15.1-orig/aclocal.m4 tar-1.15.1/aclocal.m4
--- tar-1.15.1-orig/aclocal.m4	2004-12-21 08:29:44.000000000 -0500
+++ tar-1.15.1/aclocal.m4	2006-09-25 11:01:16.000000000 -0400
@@ -1,7 +1,7 @@
-# generated automatically by aclocal 1.9.3 -*- Autoconf -*-
+# generated automatically by aclocal 1.9.6 -*- Autoconf -*-
 
-# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
-# Free Software Foundation, Inc.
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
+# 2005  Free Software Foundation, Inc.
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -11,23 +11,11 @@
 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
 # PARTICULAR PURPOSE.
 
-#                                                        -*- Autoconf -*-
-# Copyright (C) 2002, 2003  Free Software Foundation, Inc.
-# Generated from amversion.in; do not edit by hand.
-
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# Copyright (C) 2002, 2003, 2005  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
 
 # AM_AUTOMAKE_VERSION(VERSION)
 # ----------------------------
@@ -40,26 +28,15 @@ AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api
 # Call AM_AUTOMAKE_VERSION so it can be traced.
 # This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
 AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
-	 [AM_AUTOMAKE_VERSION([1.9.3])])
-
-# AM_AUX_DIR_EXPAND
-
-# Copyright (C) 2001, 2003 Free Software Foundation, Inc.
+	 [AM_AUTOMAKE_VERSION([1.9.6])])
 
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
+# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
 
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-# 02111-1307, USA.
+# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
 
 # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
 # $ac_aux_dir to `$srcdir/foo'.  In other projects, it is set to
@@ -106,26 +83,16 @@ AC_PREREQ([2.50])dnl
 am_aux_dir=`cd $ac_aux_dir && pwd`
 ])
 
-# AM_CONDITIONAL                                              -*- Autoconf -*-
-
-# Copyright (C) 1997, 2000, 2001, 2003, 2004 Free Software Foundation, Inc.
+# AM_CONDITIONAL                                            -*- Autoconf -*-
 
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-# 02111-1307, USA.
+# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
 
-# serial 6
+# serial 7
 
 # AM_CONDITIONAL(NAME, SHELL-CONDITION)
 # -------------------------------------
@@ -149,26 +116,15 @@ AC_CONFIG_COMMANDS_PRE(
 Usually this means the macro was only invoked conditionally.]])
 fi])])
 
-# serial 7						-*- Autoconf -*-
 
-# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004
+# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
 # Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
 
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-# 02111-1307, USA.
-
+# serial 8
 
 # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
 # written in clear, in which case automake, when reading aclocal.m4,
@@ -177,7 +133,6 @@ fi])])
 # CC etc. in the Makefile, will ask for an AC_PROG_CC use...
 
 
-
 # _AM_DEPENDENCIES(NAME)
 # ----------------------
 # See how the compiler implements dependency checking.
@@ -317,27 +272,16 @@ AM_CONDITIONAL([AMDEP], [test "x$enable_
 AC_SUBST([AMDEPBACKSLASH])
 ])
 
-# Generate code to set up dependency tracking.   -*- Autoconf -*-
+# Generate code to set up dependency tracking.              -*- Autoconf -*-
 
-# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004
-#   Free Software Foundation, Inc.
-
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-# 02111-1307, USA.
+# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
 
-#serial 2
+#serial 3
 
 # _AM_OUTPUT_DEPENDENCY_COMMANDS
 # ------------------------------
@@ -396,30 +340,19 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS]
      [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
 ])
 
-# Do all the work for Automake.                            -*- Autoconf -*-
+# Do all the work for Automake.                             -*- Autoconf -*-
 
-# This macro actually does too much some checks are only needed if
-# your package does certain things.  But this isn't really a big deal.
-
[...4469 lines suppressed...]
+                  strncmp (attr, "root.", strlen("root.")))
+                goto next_attr; /* only store normal xattrs */
+              
+              while (((fd == -1) ? 
+                      ((xret = getxattr (file_name, attr, val, asz)) == -1) :
+                      ((aret = fgetxattr (fd, attr, val, asz)) == -1)) &&
+                     (errno == ERANGE))
+                {
+                  asz <<= 1;
+                  val = xrealloc (val, asz);
+                }
+              
+              if (aret != -1)
+                xheader_xattr_add (st, attr, val, aret);
+              else if (errno != ENOATTR)
+                call_arg_warn ("fgetxattr", file_name);
+              
+             next_attr:
+              attr += len + 1;
+              xret -= len + 1;
+            }
+        }
+    }
+#endif
+}
+
+static void xattrs__fd_set(struct tar_stat_info const *st,
+                           char const *file_name, char typeflag,
+                           const char *attr,
+                           const char *ptr, size_t len)
+{
+#ifdef HAVE_XATTRS
+  if (ptr)
+    {
+      const char *sysname = "setxattr";
+      int ret = -1;
+
+      if (typeflag != SYMTYPE)
+        ret = setxattr (file_name, attr, ptr, len, 0);
+      else
+        {
+          sysname = "lsetxattr";
+          ret = lsetxattr (file_name, attr, ptr, len, 0);
+        }
+
+      if ((ret == -1) && (errno == EPERM))
+        call_arg_warn(sysname, file_name);
+      else if ((ret == -1) && (errno != EOPNOTSUPP))
+        call_arg_error(sysname, file_name);
+    }
+#endif
+}
+
+/* convert unix permissions into an ACL ... needed due to "default" ACLs */
+#ifdef HAVE_LIBACL
+static acl_t perms2acl(int perms)
+{
+  char val[] = "user::---,group::---,other::---";
+  /*            0123456789 123456789 123456789 123456789 */
+
+   /* user */
+  if (perms & 0400) val[ 6] = 'r';
+  if (perms & 0200) val[ 7] = 'w';
+  if (perms & 0100) val[ 8] = 'x';
+
+  /* group */
+  if (perms & 0040) val[17] = 'r';
+  if (perms & 0020) val[18] = 'w';
+  if (perms & 0010) val[19] = 'x';
+
+  /* other */
+  if (perms & 0004) val[28] = 'r';
+  if (perms & 0002) val[29] = 'w';
+  if (perms & 0001) val[30] = 'x';
+  
+  return (acl_from_text (val));
+}
+#endif
+
+static void xattrs__acls_set(struct tar_stat_info const *st,
+                             char const *file_name, int type,
+                             const char *ptr, size_t len)
+{ /* "system.posix_acl_access" */
+#ifdef HAVE_LIBACL
+  acl_t acl;
+
+  if (ptr)
+    {
+      /* assert (strlen (ptr) == len); */
+      acl = acl_from_text (ptr);
+      acls_option = 1;
+    }
+  else if (acls_option > 0)
+    acl = perms2acl (st->stat.st_mode);
+  else
+    return; /* don't call acl functions unless we first hit an ACL, or
+               --acls was passed explicitly */
+  
+  if (acl == (acl_t)NULL)
+    {
+      call_arg_warn ("acl_from_text", file_name);
+      return;
+    }
+  
+  if (acl_set_file (file_name, type, acl) == -1)
+    {
+      if (errno != ENOTSUP)
+        call_arg_warn ("acl_set_file", file_name);
+    }
+  acl_free (acl);
+#endif
+}
+
+void xattrs_acls_set(struct tar_stat_info const *st,
+                     char const *file_name, char typeflag)
+{
+  if ((acls_option >= 0) && (typeflag != SYMTYPE))
+    {
+#ifdef HAVE_LIBACL
+      xattrs__acls_set (st, file_name, ACL_TYPE_ACCESS,
+                        st->acls_a_ptr, st->acls_a_len);
+      if (S_ISDIR (st->stat.st_mode))
+        xattrs__acls_set (st, file_name, ACL_TYPE_DEFAULT,
+                          st->acls_d_ptr, st->acls_d_len);
+#endif
+    }
+}
+
+void xattrs_selinux_set(struct tar_stat_info const *st,
+                        char const *file_name, char typeflag)
+{
+#ifdef HAVE_LIBSELINUX
+  if ((selinux_context_option >= 0) && st->cntx_name)
+    {
+      const char *sysname = "setfilecon";
+      int ret = -1;
+      
+      if (typeflag != SYMTYPE)
+        ret = setfilecon (file_name, st->cntx_name);
+      else
+        {
+          sysname = "lsetfilecon";
+          ret = lsetfilecon (file_name, st->cntx_name);
+        }
+
+      if ((ret == -1) && (errno == EPERM))
+        call_arg_warn(sysname, file_name);
+      else if ((ret == -1) && (errno != EOPNOTSUPP))
+        call_arg_error(sysname, file_name);
+    }
+#endif
+}
+
+void xattrs_xattrs_set(struct tar_stat_info const *st,
+                       char const *file_name, char typeflag)
+{
+#ifdef HAVE_XATTRS
+  if ((xattrs_option >= 0) && st->xattr_map_size)
+    {
+      size_t scan = 0;
+      
+      while (scan < st->xattr_map_size)
+        {
+          char *keyword = st->xattr_map[scan].xkey;
+
+          /* assert (!memcpy (keyword, "SCHILY.xattr.", strlen("SCHILY.xattr."))); */
+          keyword += strlen("SCHILY.xattr.");
+
+          if (strncmp (keyword, "user.", strlen("user.")) &&
+              strncmp (keyword, "root.", strlen("root.")))
+            continue; /* don't try and set anything but normal xattrs */
+            
+          /* should we ignore root.* EPERM errors when not root ? */
+          xattrs__fd_set (st, file_name, typeflag, keyword,
+                          st->xattr_map[scan].xval_ptr,
+                          st->xattr_map[scan].xval_len);
+      
+          ++scan;
+        }
+    }
+#endif
+}
+
--- tar-1.15.1-orig/src/xattrs.h	1969-12-31 19:00:00.000000000 -0500
+++ tar-1.15.1/src/xattrs.h	2006-09-25 11:01:16.000000000 -0400
@@ -0,0 +1,14 @@
+
+extern void xattrs_acls_get(struct tar_stat_info *st,
+                            char const *file_name, int fd);
+extern void xattrs_selinux_get(struct tar_stat_info *st,
+                               char const *file_name, int fd);
+extern void xattrs_xattrs_get(struct tar_stat_info *st,
+                              char const *file_name, int fd);
+
+extern void xattrs_acls_set(struct tar_stat_info const *st,
+                            char const *file_name, char typeflag);
+extern void xattrs_selinux_set(struct tar_stat_info const *st,
+                               char const *file_name, char typeflag);
+extern void xattrs_xattrs_set(struct tar_stat_info const *st,
+                              char const *file_name, char typeflag);


Index: .cvsignore
===================================================================
RCS file: /cvs/dist/rpms/tar/FC-5/.cvsignore,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- .cvsignore	13 Sep 2006 20:17:34 -0000	1.9
+++ .cvsignore	29 Sep 2006 15:41:54 -0000	1.10
@@ -1,3 +1,3 @@
-tar-1.15.91.tar.gz
-tar-1.15.91.tar.gz.sig
+tar-1.15.1.tar.gz
+tar-1.15.1.tar.gz.sig
 tar.1


Index: sources
===================================================================
RCS file: /cvs/dist/rpms/tar/FC-5/sources,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- sources	13 Sep 2006 20:17:34 -0000	1.10
+++ sources	29 Sep 2006 15:41:54 -0000	1.11
@@ -1,3 +1,3 @@
-fd74a2f1840e80d27bc6cc4bd07d5374  tar-1.15.91.tar.gz
-2aabe87c0ea26c84c51e1d446ad4327f  tar-1.15.91.tar.gz.sig
+d87021366fe6488e9dc398fcdcb6ed7d  tar-1.15.1.tar.gz
+4be36b7651557cc236ed6fe9b6966fee  tar-1.15.1.tar.gz.sig
 0ee6e8f5657a0b8f08723bb0095aec18  tar.1


Index: tar.spec
===================================================================
RCS file: /cvs/dist/rpms/tar/FC-5/tar.spec,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -r1.35 -r1.36
--- tar.spec	13 Sep 2006 20:17:34 -0000	1.35
+++ tar.spec	29 Sep 2006 15:41:54 -0000	1.36
@@ -1,16 +1,29 @@
 Summary: A GNU file archiving program.
 Name: tar
-Version: 1.15.91
-Release: 1.FC5
+Epoch: 2
+Version: 1.15.1
+Release: 14.FC5
 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-loneZeroWarning.patch
-Patch2: tar-1.15.1-vfatTruncate.patch
-Patch3: tar-1.15.91-makeCheck.patch
+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
 Prereq: info
 BuildRequires: autoconf automake gzip
 Buildroot: %{_tmppath}/%{name}-%{version}-root
@@ -29,9 +42,21 @@
 
 %prep
 %setup -q
-%patch1 -p1 -b .loneZeroWarning
-%patch2 -p1 -b .vfatTruncate
+%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
 
 %build
 
@@ -94,6 +119,10 @@
 %{_infodir}/tar.info*
 
 %changelog
+* Sat Sep 29 2006 Peter Vrabec <pvrabec at redhat.com> 2:1.15.1-14.FC5
+- start new epoch, downgrade to solid stable tar-1.15.1 (#207115),
+- all patches are backported
+
 * Wed Sep 13 2006 Peter Vrabec <pvrabec at redhat.com> 1.15.91-1.FC5
 - upgrade
 


--- tar-1.15.91-makeCheck.patch DELETED ---




More information about the fedora-cvs-commits mailing list