Skip to content

[Windows] Junction links (symlinks) are being synced #5019

Closed

Description

@Pathduck

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

  1. Create an NTFS junction point in a synced folder
  2. Start client and add folder
  3. 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.

Client configuration

Client version: 2.2.2

Operating system: Windows 10 Pro, x64

OS language: English UK

Installation path of client: d:\bin\ownCloud\

Logs

Will provide if needed.

Activity

  1. 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
  2. ckamm commented on Jul 6, 2016

    @ckamm
    Contributor

    Quick tests: Linux symbolic links skipped by 2.2.2, but Windows directory symbolic links and junctions are uploaded.

  3. ckamm commented on Jul 6, 2016

    @ckamm
    Contributor

    @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.

  4. dragotin commented on Jul 6, 2016

    @dragotin
    Contributor

    @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.

  5. ckamm commented on Jul 6, 2016

    @ckamm
    Contributor

    @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 .

  6. ckamm commented on Jul 6, 2016

    @ckamm
    Contributor

    @dragotin Pull request: #5036

    Note that we accidentally broke that for 2.2.0 - people may complain if we restore the old behavior again....

  7. Pathduck commented on Jul 6, 2016

    @Pathduck
    Author

    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 :)

  8. added
    ReadyToTest
    on Jul 8, 2016
  9. 29 remaining items

  10. SamuAlfageme commented on Feb 12, 2018

    @SamuAlfageme
    Contributor

    @ckamm could FileSystem::isJunction() from #6349 be also useful in this context?

  11. ckamm commented on Feb 15, 2018

    @ckamm
    Contributor

    @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.

  12. 9k22 commented on Feb 16, 2018

    @9k22

    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.

  13. guruz commented on Mar 28, 2018

    @guruz
    Contributor

    @ckamm didn't you do something related to this topic recently?

  14. ckamm commented on Mar 29, 2018

    @ckamm
    Contributor

    @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:

    • Changes behavior. Someone somewhere will depend on symlinks being ignored.
    • How does propagating remote renames/moves work (the local symlink could be relative?)
    • 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?
  15. 9k22 commented on Mar 29, 2018

    @9k22

    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.

  16. modified the milestones: 2.5.0, 2.6.0 on Apr 4, 2018
  17. aib commented on Apr 24, 2018

    @aib

    Changes behavior. Someone somewhere will depend on symlinks being ignored.

    Make it optional. Also, https://xkcd.com/1172/ :)

    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)

  18. ogoffart commented on Dec 3, 2018

    @ogoffart
    Contributor

    I guess this is the same as #1440

  19. modified the milestones: 2.6.0, 2.7.0 on Mar 25, 2019
  20. TheOneRing commented on Mar 17, 2021

    @TheOneRing
    Contributor

    Closing as duplicate of #1440

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions