You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
Great effort!
We are trying to use your code and it seems the index file is not created correctly for long files names inside a tar. Changing the Tar index creation part to use TarArchiveInputStream
with:
while (null != (tarArchiveEntry = tarArchiveInputStream.getNextTarEntry())) ...
instead of using the byte array seems to fix the problem.
The text was updated successfully, but these errors were encountered:
More investigation brought me here: http://stackoverflow.com/questions/2078778/what-exactly-is-the-gnu-tar-longlink-trick
So, for long file names there is a special Tar entry before the real file entry that its data is the actual file name.
I made a fix to the index creation (also makes sure these special long-name meta entries aren't added to index).
There is still a problem in getFileInfo, as the index (that now holds the correct name) is compared against the name from the TarArchiveEntry (which is not read fully yet again). I comment this check for now.
When I first wrote it I had only format defined by POSIX.1-1988 (ustar) in mind. This format supports filenames upto 256 char (https://www.gnu.org/software/tar/manual/html_chapter/tar_8.html). I do not think it works for POSIX.1-2001 and we do not currently have any special handling for different types of tar headers (L or otherwise).
I vaguely remember that I first tried using tarArchiveInputStream.getNextTarEntry() for index creation. But probably it caused some issues and hence I had to do the offset manipulation myself. I can not recollect the reason now.
I plan to revisit this as soon as I have some bandwidth (maybe in a couple of weeks). If you have some immediate fix, you are welcome too.
Hi,
Great effort!
We are trying to use your code and it seems the index file is not created correctly for long files names inside a tar. Changing the Tar index creation part to use TarArchiveInputStream
with:
while (null != (tarArchiveEntry = tarArchiveInputStream.getNextTarEntry())) ...
instead of using the byte array seems to fix the problem.
The text was updated successfully, but these errors were encountered: