]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Complay with the spirit, if not the letter of the GNU sparse file rule.
authorJoerg Sonnenberger <joerg@bec.de>
Fri, 21 Apr 2017 00:11:43 +0000 (02:11 +0200)
committerJoerg Sonnenberger <joerg@bec.de>
Fri, 21 Apr 2017 00:11:43 +0000 (02:11 +0200)
libarchive/archive_write_set_format_pax.c

index 6a301ac2d196230b9a3398a42c6b9d45ab9027bc..5fdfd9dd80aa09385b6a6e2ab2fc2062c399fcff 100644 (file)
@@ -1650,13 +1650,14 @@ build_pax_attribute_name(char *dest, const char *src)
  * GNU PAX Format 1.0 requires the special name, which pattern is:
  * <dir>/GNUSparseFile.<pid>/<original file name>
  *
+ * Since reproducable archives are more important, use 0 as pid.
+ *
  * This function is used for only Sparse file, a file type of which
  * is regular file.
  */
 static char *
 build_gnu_sparse_name(char *dest, const char *src)
 {
-       char buff[64];
        const char *p;
 
        /* Handle the null filename case. */
@@ -1682,15 +1683,9 @@ build_gnu_sparse_name(char *dest, const char *src)
                break;
        }
 
-#if HAVE_GETPID && 0  /* Disable this as pax attribute name. */
-       sprintf(buff, "GNUSparseFile.%d", getpid());
-#else
-       /* If the platform can't fetch the pid, don't include it. */
-       strcpy(buff, "GNUSparseFile");
-#endif
        /* General case: build a ustar-compatible name adding
         * "/GNUSparseFile/". */
-       build_ustar_entry_name(dest, src, p - src, buff);
+       build_ustar_entry_name(dest, src, p - src, "GNUSparseFile.0");
 
        return (dest);
 }