[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Another weird tar issue (100 character filenames)



On Tue, 2006-06-27 at 13:09 +0200, Jeroen van Wolffelaar wrote:

> But on the other hand, according to the 'be strict in what you send,
> liberal in what you accept' mantra, it makes sense for tar to not create
> tarfiles which in the past have caused issues for certain programs while
> there's a perfectly fine way to create tarfiles which cannot trigger
> such bugs.

Might the patch in #230910 need to be re-crafted and re-applied?  The
code has changed enough that it wasn't obvious to me when moving to the
new upstream that we still needed this change, but perhaps we do.

If you have time to try the attached patch and let me know if it solves
your problem, I'd appreciate it...  I *think* this is a relatively
equivalent set of changes for the current version of tar.

Bdale

Index: create.c
===================================================================
RCS file: /cvs/bdale/debian/tar/src/create.c,v
retrieving revision 1.22
diff -u -u -r1.22 create.c
--- create.c	22 Jun 2006 21:06:13 -0000	1.22
+++ create.c	28 Jun 2006 23:22:15 -0000
@@ -633,7 +633,7 @@
       return write_short_name (st);
     }
   else if (NAME_FIELD_SIZE - (archive_format == OLDGNU_FORMAT)
-	   < strlen (st->file_name))
+	   <= strlen (st->file_name))
     return write_long_name (st);
   else
     return write_short_name (st);
@@ -1310,7 +1310,7 @@
 	  block_ordinal = current_block_ordinal ();
 	  assign_string (&st->link_name, link_name);
 	  if (NAME_FIELD_SIZE - (archive_format == OLDGNU_FORMAT)
-	      < strlen (link_name))
+	      <= strlen (link_name))
 	    write_long_link (st);
 
 	  st->stat.st_size = 0;
@@ -1595,7 +1595,7 @@
 	}
       buffer[size] = '\0';
       assign_string (&st->link_name, buffer);
-      if (NAME_FIELD_SIZE - (archive_format == OLDGNU_FORMAT) < size)
+      if (NAME_FIELD_SIZE - (archive_format == OLDGNU_FORMAT) <= size)
 	write_long_link (st);
 
       block_ordinal = current_block_ordinal ();

Reply to: