Description
A POSIX-format archive that came from sysdiagnose produces NumberFormatException[1] when I try to read it with TarArchiveInputStream.
The relevant part of the .tar file looks like this:
18 uid=429496729
That's the uid of 'nobody' on Mac OS (on Mac OS, uid_t is 'unsigned int').
POSIX doesn't say anything about the width of the uid extended header[2], so I assume the tar file is okay. GNU tar doesn't have trouble with it.
The relevant code, in applyPaxHeadersToCurrentEntry:
} else if ("gid".equals(key))
{ currEntry.setGroupId(Integer.parseInt(val)); ... } else if ("uid".equals(key)){
currEntry.setUserId(Integer.parseInt(val));
uid_t and gid_t are typically unsigned 32-bit integers, so these should presumably use Long.parseLong to handle integers with the top bit set (and TarArchiveEntry would need some modifications to handle large uid and gid, too).
[1] java.lang.NumberFormatException: For input string: "4294967294"
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
at java.lang.Integer.parseInt(Integer.java:495)
at java.lang.Integer.parseInt(Integer.java:527)
at org.apache.commons.compress.archivers.tar.TarArchiveInputStream.applyPaxHeadersToCurrentEntry(TarArchiveInputStream.java:488)
at org.apache.commons.compress.archivers.tar.TarArchiveInputStream.paxHeaders(TarArchiveInputStream.java:415)
at org.apache.commons.compress.archivers.tar.TarArchiveInputStream.getNextTarEntry(TarArchiveInputStream.java:295)
[2] http://pubs.opengroup.org/onlinepubs/9699919799/utilities/pax.html#tag_20_92_13_03
uid
The user ID of the file owner, expressed as a decimal number using digits from the ISO/IEC 646:1991 standard. This record shall override the uid field in the following header block(s). When used in write or copy mode, pax shall include a uid extended header record for each file whose owner ID is greater than 2097151 (octal 7777777).
Attachments
Issue Links
- relates to
-
COMPRESS-315 tar can not write uid or gid >= 0x80000000
- Resolved