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
Currently, TarEntry.cs, in GetFileTarHeader, trims all leading forward slashes.
Trying to write /home/username/foo.txt as an entry would to write home/username/foo.txt
This prevents writing absolute paths to the archive, and also breaks the RootPath string, as the entry name will no longer have the root path as a sub string (if it was set to /home/username), so it will never match when the entry is added to the archive.
If we're trying to specifically avoid UNC path names, it might be easier to just test for a leading double back slash in the original path (instead of testing for leading slashes).
Expected behavior
RootPath should work as expected when adding absolute paths on POSIX.
Actual behavior
RootPath does not work as expected - file strings will never match RootPath because RootPath will still contain the leading '/', but the file entry will not.
Additionally, absolute file paths will be broken, regardless if root path is used.
changed the title [-]Tar does not handle POSIX absolute paths correctly (trims leading '/'), breaks RootPath[/-][+]TarEntry does not support absolute paths[/+]on Nov 22, 2020
Activity
Fix icsharpcode#337 and partially icsharpcode#338
Fix icsharpcode#337 and partially icsharpcode#338
piksel commentedon Feb 1, 2020
Couldn't you just set the
RootPathto"home/username"?piksel commentedon Nov 22, 2020
This is probably a duplicate of #38 (how fitting). But that one only contains dead links and not a clear description. Closing it in favor of this one.
[-]Tar does not handle POSIX absolute paths correctly (trims leading '/'), breaks RootPath[/-][+]TarEntry does not support absolute paths[/+]