Sisyphus repository
Last update: 1 october 2023 | SRPMs: 18631 | Visits: 37912513
en ru br
ALT Linux repos
S:1.2.20-alt2.git.6d0ab4c

Group :: System/Libraries
RPM: libtar

 Main   Changelog   Spec   Patches   Sources   Download   Gear   Bugs and FR  Repocop 

Patch: oldgnu_prefix.patch
Download


Description: Detect old-style GNU headers correctly
Author: Steinar H. Gunderson <sesse@debian.org>
--- libtar-1.2.20.orig/lib/decode.c
+++ libtar-1.2.20/lib/decode.c
@@ -69,7 +69,14 @@ th_get_pathname(TAR *t)
 			return NULL;
 	}
 
-	if (t->th_buf.prefix[0] == '\0')
+	/*
+	 * Old GNU headers (also used by newer GNU tar when doing incremental
+	 * dumps) use the POSIX prefix field for many other things, such as
+	 * mtime and ctime. New-style GNU headers don't, but also don't use the
+	 * POSIX prefix field. Thus, only honor the prefix field if the archive
+	 * is actually a POSIX archive. This is the same logic as GNU tar uses.
+	 */
+	if (strncmp(t->th_buf.magic, TMAGIC, TMAGLEN - 1) != 0 || t->th_buf.prefix[0] == '\0')
 	{
 		sprintf(t->th_pathname, "%.100s", t->th_buf.name);
 	}
 
design & coding: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
current maintainer: Michael Shigorin