Discussion:
[Bug-tar] ustar-format archives with 32-char long user/group names are misinterpreted
Michał Górny
2018-11-24 08:59:10 UTC
Permalink
Hello,

I've been tinkering with the tar format limitations and noticed that GNU
tar (as of v1.30) misbehaves when given ustar-format archive created by
bsdtar (from libarchive) and using 32-char long user/group name.

The output is:

$ tar -tvf test.tar
-rw-r--r-- verylongverylongverylongverylongverylongverylongverylongverylong000000 /verylongverylongverylongverylong000000 5 2018-11-24 09:28 input.txt

Note that it does not enforce the 32-octet limit on the fields,
and concatenates the values with the fields following them. I've
already reported the issue to libarchive as well [1] since it seems to
violate the POSIX ustar format but I suppose GNU tar might want to
handle this problem more gracefully.

To reproduce:

useradd verylongverylongverylongverylong
echo test > input.txt
chown verylongverylongverylongverylong:verylongverylongverylongverylong input.txt
bsdtar --format=ustar -cf test.tar input.txt
tar -tvf test.tar

[1]:https://github.com/libarchive/libarchive/issues/1093
--
Best regards,
Michał Górny
Sergey Poznyakoff
2018-11-24 16:01:33 UTC
Permalink
Hi Micha,

Thanks for the report. I've pushed commit ba472050 to fix that.

Regards,
Sergey
Joerg Schilling
2018-11-26 11:37:04 UTC
Permalink
Post by Michał Górny
Hello,
I've been tinkering with the tar format limitations and noticed that GNU
tar (as of v1.30) misbehaves when given ustar-format archive created by
bsdtar (from libarchive) and using 32-char long user/group name.
$ tar -tvf test.tar
-rw-r--r-- verylongverylongverylongverylongverylongverylongverylongverylong000000 /verylongverylongverylongverylong000000 5 2018-11-24 09:28 input.txt
Well, this is not a ustar archive since ustar requires these two strings to be
null terminated.

A program however should be able to deal with such an incorrect archive.


The standard only permits name, linkname and prefix to be not nul terminated
in case the whole string length is used.

Jörg
--
EMail:***@schily.net (home) Jörg Schilling D-13353 Berlin
***@fokus.fraunhofer.de (work) Blog: http://schily.blogspot.com/
URL: http://cdrecord.org/private/ http://sf.net/projects/schilytools/files/'
Loading...