What steps will reproduce the problem?
1. Create an tar archive
2. Open the tar archive using 7zip
3. Add an additional file to the archive)
4. Read the archive using tar-cs
What is the expected output? What do you see instead?
Expected: Read the archive
Instead: Exception in 'UpdateHeaderFromBytes', 'Mode =
Convert.ToInt32(Encoding.ASCII.GetString(buffer, 100, 7)', reason: buffer
content contains whitespaces at beginning and end.
What version of the product are you using? On what operating system?
Please provide any additional information below.
I found some information about whitespaces: 'POSIX requires numeric fields to
be zero-padded in the front, and allows them to be terminated with either space
or NUL characters.'
(http://people.freebsd.org/~kientzle/libarchive/man/tar.5.txt)
As far as I understood from the various documentation on the tar file format,
numeric fields may contain whitespaces for padding in numeric fields.
Fixed this problem the following way:
Mode = Convert.ToInt32(Encoding.ASCII.GetString(buffer, 100, 7).TrimStart('
').TrimEnd(' '), 8);
UserId = Convert.ToInt32(Encoding.ASCII.GetString(buffer, 108, 7).TrimStart(' ').TrimEnd(' '), 8);
GroupId = Convert.ToInt32(Encoding.ASCII.GetString(buffer, 116, 7).TrimStart(' ').TrimEnd(' '), 8);
Original issue reported on code.google.com by ulrich.k...@googlemail.com on 13 Mar 2013 at 8:27
Original issue reported on code.google.com by
ulrich.k...@googlemail.com
on 13 Mar 2013 at 8:27