Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Files in a symlinked folder get deleted #1295

Closed
dadosch opened this issue Jun 8, 2019 · 9 comments
Closed

Files in a symlinked folder get deleted #1295

dadosch opened this issue Jun 8, 2019 · 9 comments

Comments

@dadosch
Copy link

dadosch commented Jun 8, 2019

Expected behaviour

The files should not be deleted, as they are outside the synced folder.

Actual behaviour

They get deleted.

Steps to reproduce

  1. create a folder in Nextcloud, say "folder", and "folder/example"
  2. create a sync for that folder to a local folder, say "Nextcloud/folder"
  3. (you might want to add some files to test it)
  4. create a symlink from a local folder to "Nextcloud/folder/example".
  5. (add some files again)
  6. Delete "folder/example" in Nextcloud
  7. Symlinked folder content gets deleted as well.

Client configuration

Client version: git 56c905, 2.5.2git

Operating system: Arch linux

OS language: German

Qt version used by client package (Linux only, see also Settings dialog): 5.12.3

Client package (From Nextcloud or distro) (Linux only): Distro

@dadosch dadosch changed the title Files in a symlinked folder gets deleted Files in a symlinked folder get deleted Jun 8, 2019
@Gigadoc2
Copy link

I can confirm this with 2.6.2.

With the risk of sounding entitled, I think this issue should be higher priority, as it can cause data loss: As the sync client does not follow symlinks when adding files, but does so when deleting them, there is plenty of opportunity to accidentially delete data.
One scenario could be that the user does not realize the synchronized folder contains symlinks, and as none of the linked files/folders are uploaded, they also don't show up in the web interface. If the user later deletes the synchronized folder in the web interface, they probably expect only those files listed in the webinterface to also be deleted from synchronized clients. They probably don't expect that the deletion will extend to files which are not listed in the web interface.
Another scenario (which would be me 😇) is that the user uses symlinks to deliberately exclude subfolders from synchronization, for example to link from a synchronized folder with report documents to a related git repository (the git repo is already "synchronized" in a different way, and synchronizing a git folder via nextcloud takes a long time). Now when the synchronized folder is removed for some reason, the linked to git project gets deleted as well, which is not the intended outcome.

To make things worse, if you periodically "backup" synchronized folders to limit the damage caused by a sync gone wrong, the usual tools (e.g cp) do not follow symlinks themselves, but copy them as is, so the folders affected by this behavior are not even included in your backup. In general, it is not the expected behavior of any application to follow symlinks when deleting.

Right now it seems that users should avoid using any symlinks at all inside the synchronized folders.

@vtronko
Copy link

vtronko commented Jul 13, 2020

I see a confirmation dialog, asking whether or not do I agree with deletion of local files, so nothing happens subtly.

@dadosch
Copy link
Author

dadosch commented Jul 13, 2020

I see a confirmation dialog, asking whether or not do I agree with deletion of local files, so nothing happens subtly.

Well, the default behaviour of rm is not to follow symlinks, so one can assume that the sync client behaves similar. Also you expect nextcloud only to delete files which are indeed in the cloud not outside of the sync folder (and syncing a simlink currenly doesn't sync the contents, as @Gigadoc2 wrote).

@er-vin er-vin added the bug label Jul 13, 2020
@vtronko
Copy link

vtronko commented Jul 14, 2020

create a sync for that folder to a local folder, say "Nextcloud/folder"
create a symlink from a local folder to "Nextcloud/folder/example".

So you have a following structure:

.
└── Nextcloud
   └── folder (this folder right here is supposed to be synced with remote folder on server)
      ├── example
      └── symlink_to_example -> example

Delete "folder/example"

I don't see what is a problem here, both symlink and the content it is linking to are supposed to be deleted. Even without all the synchronization thing, if I remove the same folder locally, the same behavior happens, I have an empty Nextcloud folder in the end.

It looks confusing to me, can you please elaborate what exactly is wrong in my understanding?

@Gigadoc2
Copy link

@vtronko: It becomes a problem once symlinks point outside of the synchronized folder. Think of a structure like this:

.
├── External
│   └── example
│       └── data
└── Nextcloud
    └── folder (still the folder to be synced)
        └── example -> ../../External/example

If you now remove "folder" via Nextcloud, "data" gets deleted as well.

@github-actions
Copy link

github-actions bot commented May 6, 2021

This bug report did not receive an update in the last 4 weeks. Please take a look again and update the issue with new details, otherwise the issue will be automatically closed in 2 weeks. Thank you!

@github-actions github-actions bot added the stale label May 6, 2021
@github-actions
Copy link

This bug report is getting automatically closed due to no answer since the issue has been staled. Thank you!

@Gigadoc2
Copy link

Gigadoc2 commented May 27, 2021

The behaviour has indeed changed now, but maybe not for the better: The Nextcloud client now gets stuck in this situation. After restarting it manually, it seems to delete everyting as appropriate, except for the symlink itself (which is perfectly acceptable considering that Nextcloud also does not sync symlinks). Just the getting stuck part is probably not intended.

@FlexW
Copy link

FlexW commented May 28, 2021

@Gigadoc2 thank you for your reply. Could you open up a ticket for that? So that we can better track the remaining issue?

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

No branches or pull requests

6 participants