brendan-duncan/archive

Version 3.3.8 corrupts symlinked files when extracting

Elleo opened this issue · 5 comments

Elleo commented

Hi,

After upgrading to version 3.3.8 of the package I found that any tar file containing symlinks results in corrupted output of the file being symlinked to. I've attached an example file test.tar.gz (Gzip compression isn't required to demonstrate this behaviour, but github won't accept plain tar files as attachments) which contains two files:

  • b.txt - Contains a string of text
  • a.txt - A symlink to b.txt

After extracting with version 3.3.7 the files are correct, however after extracting with 3.3.8 the "b.txt" file contains what looks like the start of the tar header instead of the file contents.

Also attached are the output of running extractToDisk with versions 3.3.7 and 3.3.8 to show the difference in behaviour:

output-3.3.7.tar.gz
output-3.3.8.tar.gz

Thanks!

That sounds bad. I'll take a look.

I believe I have it fixed. It was closing the input file before it finished extracting the files. The fix is in github, I'll publish as soon as I can take a look at some other issues.

Elleo commented

Brilliant, thanks for looking at this so quickly!

I pushed out the fix in 3.3.9 because I'm not sure how long it will take to look at the other things I was going to do.

Elleo commented

Great, I've just tested with my application and everything is working correctly again; thanks very much!