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
{{ message }}
Repository navigation
[Windows] Junction links (symlinks) are being synced #5019
Since the 2.2.2 update the client has started syncing directories linked by junction points (symlinks on Windows).
I am syncing My Documents folder, on Windows this contains a "My Games" folder which often gets very large. I have created a junction point to another drive to save space on c:.
Earlier versions of the OC client did not sync these, I believe junctions stopped syncing some 1.x release. Now they are suddenly back to working, and I did not find any thing in the release log to explain why they would now work when before they did not. If they now are expected to work I have to rethink my folder setup.
Steps to reproduce
Create an NTFS junction point in a synced folder
Start client and add folder
The files in the linked folder will also be synced
Expected behaviour
I would expect links (junction points) to not be synced
Actual behaviour
The files in the linked folder are synced
Server configuration
Owncloud 9.0
I don't own the server, it's a shared hosting solution.
I assume this is a client issue.
changed the title [-]Client 2.2.2 Win10 x64: Junction links are being synced[/-][+][2.2.2] Win10 x64: Junction links are being synced[/+]on Jun 29, 2016
@dragotin I've debugged this a bit, and it looks like an unintended consequence of 055c2ef (for #4056). When I remove the checks for SIS and DEDUP, the symbolic link and junction point gets ignored again on windows.
Personally I would have preferred symlinks and junctions to actually work but I understand that it's complicated - at least now it can hopefully be predictable again :)
@SamuAlfageme No. Detecting symlinks and junctions is something we already do during discovery. The main obstacle to synchronizing these is that one would need to think carefully about the desired behavior and implement that. And that's not been a priority so far.
Exactly. BTW: the "need to think carefully about the desired behavior" is IMHO not that big thing: the strategy of e.g. dropbox is perfect: simple to understand, simple to communicate, totally Independent from the way it is organized on the client side, and behaves exactly as I need it. And this is really not "rocket science". I wonder, why not just copy and implement the dropbox behaviour ? Until this is not done, I cannot move from dropbox to owncloud.
I agree with the identified issues. Proposed mitigation:
ad a) let the user choose the preferred symlink behaviour.
ad b) rename: why is it a Problem ? Move: absolute symlink: why is it a Problem ? relative: if the symlink breaks, the file is gone (see ad c))
ad c) a broken link does not refer to an existing file System object. You could not even make use of such a broken link on the local device, so, why would you think, that it should be preserved on the Server? If a user chooses explicit symlink behaviour, then it is his responsibility, that symlinks do not break. Even if they break: worst case is deleting the copy on the Server, but at least not the original local data. BTW: this is exactly the behaviour of Dropbox and it is fine that way (even although I wondered, why parts of my server data had disappeared ;-) )
BTW: Dropbox does not even care, if a duplicate of a file is a physical copy, or a symlink on the local device. It just checks, that it is the same file (checksum) and stores it only once on the server and keeps track of all references. That's simply - perfect.
How does propagating remote renames/moves work (the local symlink could be relative?)
Rename: Rename the symlink without touching its target
Move: a) Move the symlink without touching its target. If the link was relative and is now broken, a subsequent write will create the file. The case when it cannot be created should be identical to the case with a regular file. This is the "I don't care about symlinks" option. Will create extra copies of the linked file.
b) Move the symlink without touching its target. If the link was relative and is now broken, update it to point to its old target, converting it to an absolute link if necessary. This is the "my user uses symlinks for convenience, and I'm helping them" option. Users who want their symlinks intact should not be syncing them.
Do we detect broken symlinks and preserve the server data in that case, or does a broken symlink cause the remote data to be deleted?
A broken symlink should be treated as nothing, as it barely provides any more data than a file that does not exist. A symlink entering the broken state is the same as a file being deleted (which is what is happening to the targeted file, anyway)
Activity
[-]Client 2.2.2 Win10 x64: Junction links are being synced[/-][+][2.2.2] Win10 x64: Junction links are being synced[/+]ckamm commentedon Jul 6, 2016
Quick tests: Linux symbolic links skipped by 2.2.2, but Windows directory symbolic links and junctions are uploaded.
ckamm commentedon Jul 6, 2016
@dragotin I've debugged this a bit, and it looks like an unintended consequence of 055c2ef (for #4056). When I remove the checks for SIS and DEDUP, the symbolic link and junction point gets ignored again on windows.
dragotin commentedon Jul 6, 2016
@ckamm yes, I agree on that. The question is if there is a way to detect the junction without mixing up with the network files.
ckamm commentedon Jul 6, 2016
@dragotin The problem is that the code assumes the reparse point tag is a combination of flags, when it's just a value. I can fix that, but the patch will need testing for https://github.com/owncloud/enterprise/issues/1225 and #4056 .
ckamm commentedon Jul 6, 2016
@dragotin Pull request: #5036
Note that we accidentally broke that for 2.2.0 - people may complain if we restore the old behavior again....
Pathduck commentedon Jul 6, 2016
Thanks for looking into this.
Personally I would have preferred symlinks and junctions to actually work but I understand that it's complicated - at least now it can hopefully be predictable again :)
Windows: Skip symlinks and junctions again owncloud#5019
Windows: Skip symlinks and junctions again #5019 (#5036)
29 remaining items
SamuAlfageme commentedon Feb 12, 2018
@ckamm could
FileSystem::isJunction()from #6349 be also useful in this context?ckamm commentedon Feb 15, 2018
@SamuAlfageme No. Detecting symlinks and junctions is something we already do during discovery. The main obstacle to synchronizing these is that one would need to think carefully about the desired behavior and implement that. And that's not been a priority so far.
9k22 commentedon Feb 16, 2018
Exactly. BTW: the "need to think carefully about the desired behavior" is IMHO not that big thing: the strategy of e.g. dropbox is perfect: simple to understand, simple to communicate, totally Independent from the way it is organized on the client side, and behaves exactly as I need it. And this is really not "rocket science". I wonder, why not just copy and implement the dropbox behaviour ? Until this is not done, I cannot move from dropbox to owncloud.
guruz commentedon Mar 28, 2018
@ckamm didn't you do something related to this topic recently?
ckamm commentedon Mar 29, 2018
@guruz What I did was make sure recursive deletions didn't delete data behind junctions in #6349.
I agree with @9k22 that treating a symlink as transparent and just syncing the data behind it makes sense. Potential issues:
9k22 commentedon Mar 29, 2018
I agree with the identified issues. Proposed mitigation:
ad a) let the user choose the preferred symlink behaviour.
ad b) rename: why is it a Problem ? Move: absolute symlink: why is it a Problem ? relative: if the symlink breaks, the file is gone (see ad c))
ad c) a broken link does not refer to an existing file System object. You could not even make use of such a broken link on the local device, so, why would you think, that it should be preserved on the Server? If a user chooses explicit symlink behaviour, then it is his responsibility, that symlinks do not break. Even if they break: worst case is deleting the copy on the Server, but at least not the original local data. BTW: this is exactly the behaviour of Dropbox and it is fine that way (even although I wondered, why parts of my server data had disappeared ;-) )
BTW: Dropbox does not even care, if a duplicate of a file is a physical copy, or a symlink on the local device. It just checks, that it is the same file (checksum) and stores it only once on the server and keeps track of all references. That's simply - perfect.
aib commentedon Apr 24, 2018
Make it optional. Also, https://xkcd.com/1172/ :)
Rename: Rename the symlink without touching its target
Move: a) Move the symlink without touching its target. If the link was relative and is now broken, a subsequent write will create the file. The case when it cannot be created should be identical to the case with a regular file. This is the "I don't care about symlinks" option. Will create extra copies of the linked file.
b) Move the symlink without touching its target. If the link was relative and is now broken, update it to point to its old target, converting it to an absolute link if necessary. This is the "my user uses symlinks for convenience, and I'm helping them" option. Users who want their symlinks intact should not be syncing them.
A broken symlink should be treated as nothing, as it barely provides any more data than a file that does not exist. A symlink entering the broken state is the same as a file being deleted (which is what is happening to the targeted file, anyway)
ogoffart commentedon Dec 3, 2018
I guess this is the same as #1440
TheOneRing commentedon Mar 17, 2021
Closing as duplicate of #1440