Symbolic links / Junctions are copied incorrectly

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

Moderators: white, Hacker, petermad, Stefan2

Post Reply
HAL 9000
Senior Member
Senior Member
Posts: 384
Joined: 2007-09-10, 13:05 UTC

Symbolic links / Junctions are copied incorrectly

Post by *HAL 9000 »

Well first of all its nice that TC 9.0a final at least cares for symbolic links / Junction and hard links when it find's some during copying.

That's my test Setup:
  • [face=courier]c:\!MNT\AAAAA\BBBB\
    c:\!MNT\AAAAA\BBBB _SymLink\ ->BBBB
    c:\!MNT\AAAAA\BBBB_Junction\ ->C:\!MNT\AAAAA\BBBB[/face]
edit#1
@MVV thanks for that quick reply - well my WINCMD.ini
setup is like this:
  • [face=courier][Configuration]
    ; Zielpfad bzw. Ziellaufwerk des Links nicht ไndern (=1) oder anpassen (=2)
    CopyLinks=2
    IgnoreLinks=0
    SyncIgnoreJunctions=0[/face]
Sorry forgot about this (and that I changed that once - and should mention it here) :)
-> on some drive with NTFS (within Win7 )

Case #1 - same dir
  • [face=courier]
    BBBB _SymLink => BBBB _SymLink_1
    BBBB_Junction => BBBB_Junction_1[/face]
    within the same Dir (c:\!MNT\AAAAA\BBBB _SymLink\) just works fine.
    [face=courier]
    BBBB _SymLink_1=> BBBB
    BBBB_Junction_1 => C:\!MNT\AAAAA\BBBB[/face]
Case #2 - lower dir
  • Copying to lower dir
    [face=courier]
    BBBB _SymLink => c:\!MNT\BBBB _SymLink
    BBBB_Junction => c:\!MNT\BBBB_Junction[/face]
    at this point things it starts to gets buggy.
    [face=courier]
    c:\!MNT\BBBB _SymLink -> BBBB should be AAAAA\BBBB
    c:\!MNT\BBBB_Junction => c:\!MNT\BBBB should be c:\!MNT\AAAAA\BBBB
    [/face]
    Same story - link gets wrong.
Case #3 - upper dir
  • Copying to upper dir
    [face=courier]
    BBBB _SymLink => c:\!MNT\A1\BBBB _SymLink
    BBBB_Junction => c:\!MNT\A1\BBBB_Junction[/face]
    [face=courier]
    c:\!MNT\BBBB _SymLink -> BBBB should be ..\BBBB
    c:\!MNT\BBBB_Junction => c:\!MNT\A1\BBBB should be c:\!MNT\AAAAA\BBBB[/face]
    :arrow: that links don't work anymore since the target's are wrong.
Summary

Fix
  • I guess setting
    CopyLinks=1
    in wincmd.ini will fix the problem for the test scenario.

:idea:Proposal #1 - CopyLinks=3
  • The algorithm for CopyLinks=2 adept links should be extended or do a new setting:
    • CopyLinks=3 Change links only if new link target exists.

      also take care about 'future' links
      I mean in that in the way
      • a)to move the link coping always at the very end of the copy queue or
        b) just involve in isLinkValidCheck that the link will become valid if the active copy session is complete
:idea: Proposal #2a - symlink GUI options
  • messing with the ini is not that nice in the admins workflow.
    Involve options about copying links in the GUI options box.
:idea: Proposal #2b
  • Add a button/link in options/advance that'll open current wincmd.ini.
:idea: Proposal #3
  • A wincmd.ini with comments
    ->all possible options() + their parameter
-> Okay that might be to big undertake + also I should make new thread about this


Or I make it self documenting by creative use of that GetPrivateProfile* API's that deal with ini-stuff.
Sometimes I use API Monitor (rohitab.com). Setup Ini in profile to get all possible ini options(and it's standard values) some program uses and is querying on it's startup.



How to create symbolic links, Junctions and hardlinks?
Well I use Link Shell Extension
http://schinagl.priv.at/nt/hardlinkshellext/linkshellextension.html#Download[/url]
    Last edited by HAL 9000 on 2017-04-24, 12:39 UTC, edited 5 times in total.
    User avatar
    MVV
    Power Member
    Power Member
    Posts: 8702
    Joined: 2008-08-03, 12:51 UTC
    Location: Russian Federation

    Post by *MVV »

    TC doesn't do that by default, I suppose you've enabled CopyLinks key in wincmd.ini?
    HAL 9000
    Senior Member
    Senior Member
    Posts: 384
    Joined: 2007-09-10, 13:05 UTC

    Post by *HAL 9000 »

    Thanks for mention that.
    CopyLinks=1 just fixed the problem.

    -> However please read my post and especially Proposal #1
    User avatar
    ghisler(Author)
    Site Admin
    Site Admin
    Posts: 48021
    Joined: 2003-02-04, 09:46 UTC
    Location: Switzerland
    Contact:

    Post by *ghisler(Author) »

    TC doesn't check whether the target exists or not. Why? When copying a large tree, it's possible that the link can be copied BEFORE the target.
    Author of Total Commander
    https://www.ghisler.com
    HAL 9000
    Senior Member
    Senior Member
    Posts: 384
    Joined: 2007-09-10, 13:05 UTC

    Post by *HAL 9000 »

    ghisler(Author) wrote:TC doesn't check whether the target exists or not. Why? When copying a large tree, it's possible that the link can be copied BEFORE the target.
    Wow cool thanks for ya reply.

    Well I see it'll be not that clear on how to handle/resolve such link issues.
    Maybe let do this more special task to 'Link Shell Extension' with it's confusing options like insert as 'smart copy' 'DeLorean copy' or 'Hardlink clone'... :roll:
    (Well I read the manual but still didn't got really sure about what to choose)

    Anyway what I find very important here is that
    1. TC least some notifies me about that it just copied links.

    next step useful steps/wishes would be some sort of report like this:

    Code: Select all

    LinkTarget before     | valid |     LinkType | FileName      |   LinkTarget after| valid 
    ...
    That just as rough draft / inspiration.

    Maybe you come back later to that issue.
    When TC get's an options to see some kind of
    :idea: transfer report.
    Listing read/write errors, transfer speed, read & write time.
    LeeBinder
    Junior Member
    Junior Member
    Posts: 14
    Joined: 2009-07-18, 23:09 UTC

    Re: Symbolic links / Junctions are copied incorrectly

    Post by *LeeBinder »

    me too!!! PLEASE add the available options..
    • into Settings/ Copy options
    • into the copy dialog options
    THANK YOU CHRISTIAN!
    Post Reply