On Thu, 28 Sep 2006, Henrik Grubbström wrote:

Hi.

I need to create tar archives with deep paths on a Linux machine that Solaris 10's system tar (ie /bin/tar) can extract. If I read the manuals correctly, this should be achievable by using the USTAR format.
[...]
So the main difference seems to be that the file name is missing in the record for the first long path in the gnutar case.

Any suggestions for a patch?

Suggested patch against 1.15.91 attached.

--
Henrik Grubbström                                       [EMAIL PROTECTED]
Roxen Internet Software AB
--- create.c.orig       2006-09-30 17:49:40.000000000 +0200
+++ create.c    2006-09-30 18:04:56.000000000 +0200
@@ -491,13 +491,14 @@
 static size_t
 split_long_name (const char *name, size_t length)
 {
+  const char *offset;
   size_t i;
 
-  if (length > PREFIX_FIELD_SIZE)
-    length = PREFIX_FIELD_SIZE + 1;
-  for (i = length - 1; i > 0; i--)
-    if (ISSLASH (name[i]))
-      break;
+  length--;
+  offset = strchr(name + length - NAME_FIELD_SIZE, DIRECTORY_SEPARATOR);
+  if (!offset) return 0;
+  i = offset - name;
+  if (i >= length) return 0;   /* There must be a non-empty name. */
   return i;
 }
 
_______________________________________________
Bug-tar mailing list
Bug-tar@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-tar

Reply via email to