[TC 11.56] Inconsistent handling of symbolic links in tar files

The behaviour described in the bug report is either by design, or would be far too complex/time-consuming to be changed

Moderators: petermad, Stefan2, white, Hacker

Post Reply
User avatar
white
Power Member
Power Member
Posts: 6404
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

[TC 11.56] Inconsistent handling of symbolic links in tar files

Post by *white »

Here is a encoded tar file (save as .b64 file and double click in TC to get the tar file)

Code: Select all

MIME-Version: 1.0
Content-Type: application/octet-stream; name="123.tar"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="123.tar"

MTIzLwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAwMDc3NyAAMDAwMDAw
IAAwMDAwMDAgADAwMDAwMDAwMDAwIDE1MDUzNjUyMDYzIDAwNzU0MgAgNQAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB1c3RhcgAwMAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwMDAwMDAgADAwMDAw
MCAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAx
MjMvMTIzLnR4dAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==
The folder "123" inside the tar file contains:
123.txt - Text file containing "123"
test.txt - Symbolic link to the file 123.txt (created with "mklink test.txt 123.txt" in an elevated command prompt window)

At the Windows command prompt, I created this tar file using the command:

Code: Select all

tar -cvf 123.tar 123

If I open 123.tar in TC and view the symbolic link 123\test.txt, it seem to always show:
Link: 123.txt
When I unpack test.txt it seems to create a normal text file in Unicode format, 28 bytes, containing:
Link: 123.txt
Or it contains 28 null characters.

Or it contains "123" and for the rest filled with null character, so the file size is 28 bytes.

Or it may contain something like this:
t"\"est.txt 123
(filled with zeros to file size 28, not entirely sure of the exact contents anymore because after being able to constantly reproduce it, I later no longer could).

Or it may contain the same contents as the file named "test.txt" in the parent folder of the target folder.

Or the contents of a previously used "test.txt" file, for example after I deleted the file test.txt in the parent folder.

This doesn't happen when I create a tar file with only the 2 files without subfolder, by using this command:

Code: Select all

tar -cvf mybackup.tar 123.txt test.txt
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 51909
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: [TC 11.56] Inconsistent handling of symbolic links in tar files

Post by *ghisler(Author) »

This should be fixed in Total Commander 11.57 beta 1, please check it!
29.08.25 Fixed: TAR archives: Symlinks to files were not handled correctly when located in a subdirectory. Their destination is relative to that subdirectory, not to the base of the archive (32/64)
Author of Total Commander
https://www.ghisler.com
User avatar
white
Power Member
Power Member
Posts: 6404
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: [TC 11.56] Inconsistent handling of symbolic links in tar files

Post by *white »

29.08.25 Fixed: TAR archives: Symlinks to files were not handled correctly when located in a subdirectory. Their destination is relative to that subdirectory, not to the base of the archive (32/64)
I don't understand this changelog entry. Can you explain what you mean by "Their destination is relative to that subdirectory, not to the base of the archive"?

It seems to work consistent now. When unpacking test.txt the contents will be either "Link: 123.txt" if 123.txt does not exist in the target folder, or the contents of the file 123.txt in the target folder otherwise.

When opening the tar file in TC and viewing text.txt, it will show the contents of %temp%\_tc\123.txt if that file exists. I'm not sure if that is wanted behavior.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 51909
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: [TC 11.56] Inconsistent handling of symbolic links in tar files

Post by *ghisler(Author) »

The tar file contained a link named 123\test.txt which contained as target just 123.txt. Total Commander assumed that this was pointing to 123.txt in the root of the tar file. However, it should be pointing to 123.txt in the same subdirectory 123 where the link is located.

Just try it with the above file: TC 11.56 would not extract 123\test.txt correctly - instead it would just write the name of the target inside.
TC 11.57 beta 1 will extract the content of 123\123.txt when extracting 123\test.txt.
Author of Total Commander
https://www.ghisler.com
User avatar
white
Power Member
Power Member
Posts: 6404
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: [TC 11.56] Inconsistent handling of symbolic links in tar files

Post by *white »

ghisler(Author) wrote: 2026-02-26, 08:44 UTC Just try it with the above file: TC 11.56 would not extract 123\test.txt correctly - instead it would just write the name of the target inside.
TC 11.57 beta 1 will extract the content of 123\123.txt when extracting 123\test.txt.
No, it doesn't. Try extracting 123\test.txt only. It does again write the name of the target inside. But when the file 123.txt exist in the (unpacked) target folder, the contents of this existing unpacked file is copied to text.txt when text.txt is extracted.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 51909
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: [TC 11.56] Inconsistent handling of symbolic links in tar files

Post by *ghisler(Author) »

Try extracting 123\test.txt only.
Indeed this doesn't work and can't be supported. It's also not the point of this bug report, which was about using the wrong target.
Author of Total Commander
https://www.ghisler.com
User avatar
white
Power Member
Power Member
Posts: 6404
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: [TC 11.56] Inconsistent handling of symbolic links in tar files

Post by *white »

ghisler(Author) wrote: 2026-02-27, 10:29 UTC
Try extracting 123\test.txt only.
Indeed this doesn't work and can't be supported. It's also not the point of this bug report, which was about using the wrong target.
I'm not sure if this means you want to leave things as they are now. That extracting the symbolic link is not supported is fine. The point of the bug report was to get a consistent, and most user-friendly, result when the user tries to do so. I'm not sure if that's the case now.

When a user runs into an unexpected result when extracting the symbolic link, he cannot find any information about this in the help file, and the changelog entry is only understandable when you already know what implementation was chosen. Perhaps it is best to always write the name of the target to the file?
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 51909
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: [TC 11.56] Inconsistent handling of symbolic links in tar files

Post by *ghisler(Author) »

I just changed what happens with links in subdirectories, because that was the point of this thread. What happens when the target of the link isn't there didn't change. So when you unpack the entire archive, or unpack both the link and its target, the link will contain the correct file data. Otherwise there will just be an indication of where the link file pointed to. It's currently not feasible to unpack the missing file if the user didn't choose to do so.
Author of Total Commander
https://www.ghisler.com
User avatar
white
Power Member
Power Member
Posts: 6404
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: [TC 11.56] Inconsistent handling of symbolic links in tar files

Post by *white »

ghisler(Author) wrote: 2026-03-01, 08:17 UTC I just changed what happens with links in subdirectories, because that was the point of this thread. What happens when the target of the link isn't there didn't change. So when you unpack the entire archive, or unpack both the link and its target, the link will contain the correct file data.
The report was never about unpacking the whole archive. And what you are meaning to say with the text "the link will contain the correct file data" is not true. It gives the illusion of taking the contents from the linked file in the archive, which it doesn't. The final result when unpacking the whole archive is the same, but it gives a false illusion and creates unexpected behavior in certain situations.

My point remains that the behavior (and the changelog entry) is incomprehensible to the user. The simplest and most user-friendly solution seems to be to always write a clear indication of the target (the text "Link: <target>") when a symlink is encountered. That would be 100% consistent, would clearly signal that real symlink support is not implemented, and would eliminate all the surprising side effects.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 51909
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: [TC 11.56] Inconsistent handling of symbolic links in tar files

Post by *ghisler(Author) »

That would break behaviour which has been there for many years.
Since we cannot come to an agreement, I will move this thread to "will not be changed" although the original bug has been fixed.

Moderator message from: ghisler(Author) » 2026-03-02, 17:29 UTC

Moved to will not be changed
Author of Total Commander
https://www.ghisler.com
Post Reply