bsdtar errors storing uid/gids > 16777214

Dan Nelson dnelson at allantgroup.com
Thu Sep 16 21:09:51 PDT 2004


It looks like bsdtar will create extended header entries for attributes
that would overflow the regular file header, but for the gid and uid
cases, it doesn't zero out the regular fields, and
__archive_write_format_header_ustar() ends up failing.  This bit me
when portupgrading kdebase, which installs kdesud with a group name of
"nogroup", which is -2 (aka 4294967294) on my system.

Also, there's a formatting error in tar/read.c that ends up misaligning
the date column.  %Y is 4 chars wide, but %R is 5, so the format string
with %R in it needs to lose a space.

-- 
	Dan Nelson
	dnelson at allantgroup.com
-------------- next part --------------
Index: archive_write_set_format_pax.c
===================================================================
RCS file: /home/ncvs/src/lib/libarchive/archive_write_set_format_pax.c,v
retrieving revision 1.17
diff -u -p -r1.17 archive_write_set_format_pax.c
--- archive_write_set_format_pax.c	8 Aug 2004 02:22:48 -0000	1.17
+++ archive_write_set_format_pax.c	17 Sep 2004 04:03:19 -0000
@@ -416,6 +416,7 @@ archive_write_pax_header(struct archive 
 	/* If numeric GID is too large, add 'gid' to pax extended attrs. */
 	if (st_main->st_gid >= (1 << 20)) {
 		add_pax_attr_int(&(pax->pax_header), "gid", st_main->st_gid);
+		archive_entry_set_gid(entry_main, 0);
 		need_extension = 1;
 	}
 
@@ -431,6 +432,7 @@ archive_write_pax_header(struct archive 
 	/* If numeric UID is too large, add 'uid' to pax extended attrs. */
 	if (st_main->st_uid >= (1 << 20)) {
 		add_pax_attr_int(&(pax->pax_header), "uid", st_main->st_uid);
+		archive_entry_set_uid(entry_main, 0);
 		need_extension = 1;
 	}
 
-------------- next part --------------
Index: read.c
===================================================================
RCS file: /home/ncvs/src/usr.bin/tar/read.c,v
retrieving revision 1.19.2.1
diff -u -p -r1.19.2.1 read.c
--- read.c	2 Sep 2004 04:09:46 -0000	1.19.2.1
+++ read.c	16 Sep 2004 15:13:53 -0000
@@ -282,7 +282,7 @@ list_item_verbose(struct bsdtar *bsdtar,
 	if (abs(tim - now) > (365/2)*86400)
 		fmt = bsdtar->day_first ? "%e %b  %Y" : "%b %e  %Y";
 	else
-		fmt = bsdtar->day_first ? "%e %b  %R" : "%b %e  %R";
+		fmt = bsdtar->day_first ? "%e %b %R" : "%b %e %R";
 	strftime(tmp, sizeof(tmp), fmt, localtime(&tim));
 	fprintf(out, " %s ", tmp);
 	safe_fprintf(out, "%s", archive_entry_pathname(entry));


More information about the freebsd-current mailing list