Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#270 Symbolic Link of a Single File is Overwritten

closed
nobody
None
2013-06-16
2012-03-18
Anonymous
No

(This is my first attempt at using symbolic links, so I might be reporting a bug or simply revealing user error :^> )

Using FreeFileSync v5.0
System Stats Summary:
Operating System
MS Windows 7 Home Premium 64-bit SP1
CPU
Intel Core i5 450M @ 2.40GHz 96 °F
Arrandale 32nm Technology
RAM
4.0GB Dual-Channel DDR3 @ 532MHz (7-7-7-20)
Motherboard
Hewlett-Packard 144B (CPU)
Graphics
VX2025wm (1680x1050@60Hz)
ATI Mobility Radeon HD 5470
Intel(R) Graphics Media Accelerator HD
Hard Drives
488GB TOSHIBA TOSHIBA MK5056GSY (SATA)
Optical Drives
hp BD ROM BC-5501H
Audio
IDT High Definition Audio CODEC

I'm trying to sync my Google Chrome Bookmarks file between my Home computer and my Work computer, using an external hard drive as my transfer mechanism.
I've already been successfully using FFS to keep multiple folders in sync across my systems for a couple of months.

1) I created a symlink on my computer in the Administrator Command Prompt as follows:
vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
C:\Users\John\Documents\John\Misc>dir book*
Volume in drive C has no label.
Volume Serial Number is DE59-36CB

Directory of C:\Users\John\Documents\John\Misc

File Not Found

C:\Users\John\Documents\John\Misc>mklink Bookmarks_GoogleChromeSymlink "C:\Users\John\AppData\Local\Google\Chrome\User Data\Default\Bookmarks"
symbolic link created for Bookmarks_GoogleChromeSymlink <<===>> C:\Users\John\AppData\Local\Google\Chrome\User Data\Default\Bookmarks

C:\Users\John\Documents\John\Misc>dir Bookmarks_GoogleChromeSymlink
Volume in drive C has no label.
Volume Serial Number is DE59-36CB

Directory of C:\Users\John\Documents\John\Misc

03/18/2012 03:11 PM <SYMLINK> Bookmarks_GoogleChromeSymlink [C:\Users\John\AppData\Local\Google\Chrome\User Data\Default\Bookmarks]
1 File(s) 0 bytes
0 Dir(s) 363,239,251,968 bytes free

C:\Users\John\Documents\John\Misc>dir "C:\Users\John\AppData\Local\Google\Chrome\User Data\Default\Bookmarks"
Volume in drive C has no label.
Volume Serial Number is DE59-36CB

Directory of C:\Users\John\AppData\Local\Google\Chrome\User Data\Default

03/17/2012 03:42 PM 454,626 Bookmarks
1 File(s) 454,626 bytes
0 Dir(s) 363,239,251,968 bytes free
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

2) I then created a dummy Bookmarks file in the G:\Documents folder of my external hard drive:
vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
G:\Documents>type Bookmarks
junk
G:\Documents>dir Bookmarks
Volume in drive G is Iomega_HDD
Volume Serial Number is 08F9-4DFB

Directory of G:\Documents

03/18/2012 10:34 AM 4 Bookmarks
1 File(s) 4 bytes
0 Dir(s) 478,584,037,376 bytes free
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

3) and created a symlink on the external drive pointing to that dummy Bookmarks file:
vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
G:\Documents\John\Misc>dir book*
Volume in drive G is Iomega_HDD
Volume Serial Number is 08F9-4DFB

Directory of G:\Documents\John\Misc

File Not Found

G:\Documents\John\Misc>mklink Bookmarks_GoogleChromeSymlink "G:\Documents\Bookmarks"
symbolic link created for Bookmarks_GoogleChromeSymlink <<===>> G:\Documents\Bookmarks

G:\Documents\John\Misc>dir book*
Volume in drive G is Iomega_HDD
Volume Serial Number is 08F9-4DFB

Directory of G:\Documents\John\Misc

03/18/2012 03:23 PM <SYMLINK> Bookmarks_GoogleChromeSymlink [G:\Documents\Bookmarks]
1 File(s) 0 bytes
0 Dir(s) 478,584,037,376 bytes free

G:\Documents\John\Misc>type Bookmarks_GoogleChromeSymlink
junk
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

4) Attachment "Comparison Screen Shot" shows Bookmarks_GoogleChromeSymlink as the
only difference, and I changed it to overwrite the right file with the left one.
Comparison settings => Symbolic Link handling is set to "Follow".

5) Click "Synchronize..." and the synchronization completes.

6) The G:\Documents\Bookmarks target file has not changed:
vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
G:\Documents>dir Bookmarks
Volume in drive G is Iomega_HDD
Volume Serial Number is 08F9-4DFB

Directory of G:\Documents

03/18/2012 10:34 AM 4 Bookmarks
1 File(s) 4 bytes
0 Dir(s) 478,583,582,720 bytes free
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

7) But G:\Documents\John\Misc\Bookmarks_GoogleChromeSymlink has been overwritten with the actual Bookmarks content:
vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
G:\Documents\John\Misc>dir Bookmarks_GoogleChromeSymlink
Volume in drive G is Iomega_HDD
Volume Serial Number is 08F9-4DFB

Directory of G:\Documents\John\Misc

03/17/2012 03:42 PM 454,626 Bookmarks_GoogleChromeSymlink
1 File(s) 454,626 bytes
0 Dir(s) 478,583,582,720 bytes free
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Discussion

  • Zenju
    Zenju
    2012-03-19

    I can confirm this behavior. If symbolic link handling is set to "follow" and both left and right objects are symlinks and sync direction is "to the right", then the right symlink is replaced by the target of the left symlink, which will be a regular file.

    The reason can be found in the sequence of steps in the overwrite algorithm:
    1. the object to be overwritten is deleted, in this case the symlink on right
    2. the dereferenced symlink from left is copied to right as a regular file

    TBD: what is the best behavior in this case.

    Here is a batch file to recreate this scenario:

    ::cleanup
    del source.txt
    del target.txt
    del source\link
    del target\Link
    rd source
    rd target

    ::init
    mkdir source
    mkdir target
    echo source >> source.txt
    echo target123 >> target.txt

    cd source
    mklink link ..\source.txt

    cd ..\target
    mklink Link ..\target.txt
    cd..

     
    Last edit: Zenju 2013-06-16

  • Anonymous
    2012-03-24

    Just to confirm what I think you're saying, there is currently no way to automate the syncing of my single Google Bookmarks file across various computers, correct? (I know I could configure FreeFileSync to sync the entire C:\Users\John\AppData\Local\Google\Chrome\User Data\Default folder across all machines, but I'd really prefer to sync only my single 454KB Bookmarks file, not all 3184 files/758 directories/480 Megabytes in my Default folder.)

    The workaround I'm using now is I have a C: drive Bookmarks symlink defined in the Documents\John\Misc folder on all my computers, and a Bookmarks regular file defined in Documents\John\Misc on my external hard drive. When I run FFS Compare and it wants to overwrite my external drive Bookmarks file with my C: drive file, I allow the sync to take place (since the external drive file is a regular file anyway.) Then when I see that FFS wants to overwrite my C: Bookmarks file with the external drive's version, I instead manually copy the external Bookmarks file to C:\Users\John\AppData\Local\Google\Chrome\User Data\Default so when I run Compare again, Bookmarks no longer shows up in the list.

     
    Last edit: Anonymous 2013-10-15
  • Zenju
    Zenju
    2012-03-24

    there is currently no way to automate the syncing
    of my single Google Bookmarks file across various
    computers, correct?

    There are probably a number of alternative solutions, but your initial intention to have the target of the symlink being written to instead of replacing the symlink by a regular file is currently not supported by FFS.
    I'm going to rethink this behavior, but right now it looks like FFS should be adapted to support this scenario.

     
    Last edit: Zenju 2013-06-16
  • Zenju
    Zenju
    2013-06-16

    The new version of FFS will consider the target of a file symlink during update and thereby preserve the symlink. FFS is now fully conformant in its symlink handling:
    http://freefilesync.sourceforge.net/FreeFileSync_5.17_beta_Windows_Setup.exe

     
    Last edit: Zenju 2013-06-16
  • Zenju
    Zenju
    2013-06-16

    • status: open --> closed