Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to handle decompression of symbolic links? #71

Closed
cedx opened this issue May 9, 2019 · 5 comments

Comments

Projects
None yet
2 participants
@cedx
Copy link

commented May 9, 2019

How can I properly decompress symbolic links contained in a TAR.GZ archive? The FileArchive API let us check if an entity is a file, but not if it is a symbolic link and its target path.
Is it possible? Did I miss an API?

@brendan-duncan

This comment has been minimized.

Copy link
Owner

commented May 9, 2019

There's not really a simple way of doing this now, but there should be. You might be able to do it with using TarDecoder directly. You'd use GzipDecoder to decompress the file first, then TarDecoder.decodeBytes with the decompressed buffer. Then, TarDecoder.files has a list of TarFile objects with Tar specific information about the files. TarFile.typeFlag would probably be TarFile.TYPE_SYMBOLIC_LINK if it's a symlink, and TarFile.nameOfLinkedFile would probably be the name of the file it's linked to.

I'm saying "probably" because I'm not at a place where I can test to verify if I'm right or not.

ArchiveFile should really have symlink information available to it, so I'll work on that sometime soon.

@brendan-duncan

This comment has been minimized.

Copy link
Owner

commented May 12, 2019

I got a chance to check on this, and I was right, those properties of TarFile did have the symbolic link info.

I added some properties to ArchiveFile so you can get the symlink info from there:
class ArchiveFile { ...
bool isSymbolicLink;
String nameOfLinkedFile;
}

nameOfLinkedFile is the path of the file linked to, relative to the symlink file.

The changes are in git, but not published yet.

@cedx

This comment has been minimized.

Copy link
Author

commented May 15, 2019

Thanks a lot @brendan-duncan ! I don't have a specific requirement: I can wait without problem the next release of this library. In the meantime, I will try to test your solution as soon as I have spare time.

@brendan-duncan

This comment has been minimized.

Copy link
Owner

commented May 17, 2019

I published the change in version 2.0.9.

@cedx

This comment has been minimized.

Copy link
Author

commented May 17, 2019

Great! I've tested the new release: it works as expected, so I'm closing this issue.
Another big thank you.

@cedx cedx closed this May 17, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.