client icon indicating copy to clipboard operation
client copied to clipboard

File is deleted by syncing client, if it was modified and his parent folder has moved

Open lfontaine35 opened this issue 10 years ago • 14 comments

Sorry for my english: have described an issue on forum: https://central.owncloud.org/t/file-delete-by-mistake-when-it-was-modified-and-his-parents-directory-was-moved-or-renamed/2476

Expected behaviour

When i've the following tree folder who is synced with a client 2.2.3,

/FOLDERA/file1.txt /FOLDERB

if i edit file1.txt on web interface, during a period who my sync-client is disconnect and if i move FOLDERA in FOLDERB, or if i rename FOLDERA

when the sync-client reconnect, it moved FOLDERA in FOLDERB, or rename FOLDERA, it download the file with modification and during the next verficiation for change, it declare that te file1.txt in the older location was deleted the server misunderstand and delete the file in the new location the client sync delete the file in the new location

Actual behaviour

i prefer the file was not deleted...

Steps to reproduce

  1. syncing a file in a folder
  2. desactivate syncing client
  3. editing the file for modification and saved. Rename the folder or move it
  4. reactivate syncing client and wait
  5. the file is delete and in the trashbin folder

Server configuration

Operating system: 8.6

Web server: 2.4.10

Database: mysql

PHP version: 5.6.24

ownCloud version: 9.1, it's true with 9.02 and 8.1

Storage backend (external storage): no

Client configuration

Client version: 2.2.3

Operating system: windows 7 - 8 and 10 in x64.

OS language: french

Installation path of client: %userprofile%owncloud

Logs

Please use Gist (https://gist.github.com/) or a similar code paster for longer logs.

Template for output < 10 lines

  1. Client logfile: Output of owncloud --logwindow or owncloud --logfile log.txt (On Windows using cmd.exe, you might need to first cd into the ownCloud directory) (See also http://doc.owncloud.org/desktop/2.2/troubleshooting.html#client-logfile )
  2. Web server error log:
  3. Server logfile: ownCloud log (data/owncloud.log):

lfontaine35 avatar Sep 18 '16 15:09 lfontaine35

I am not able to reproduce that (at least on Linux), and there is the code that handles this: https://github.com/owncloud/client/blob/master/csync/src/csync_update.c#L440

It compares the ETags and if they are not equal, the file is downloaded again. You should see that GET that re-downloads the file from the new location in your servers access_log.

dragotin avatar Sep 19 '16 16:09 dragotin

I was able to reproduce this on Ubuntu 16.04 and the 2.2.3-client (from repo):

  • create user1 and user2
  • share folder with them which contains folderA and folderB
  • place file1.txt in folderA
  • sync user2 with desktop client, then pause the sync process
  • login to webinterface with user1, change file1.txt
  • then move folder folderA into folder folderB
  • resume sync process for user2

I will redo it and monitor the access.log....

tflidd avatar Sep 19 '16 16:09 tflidd

Ahhh, ok, I did not have the sharing. That might be a different story. @tflidd if you redo it, can you record a log file and share with me?

dragotin avatar Sep 19 '16 17:09 dragotin

I can't really reproduce it anymore. I don't know what has changed?? But I manged to get something out of the logs from yesterday when it happened:

my-ip - user2 [18/Sep/2016:13:58:30 +0000] "PROPFIND /oct/oc91/remote.php/webdav/ HTTP/1.1" 207 1263 "-" "Mozilla/5.0 (Linux) mirall/2.2.3"
my-ip - user2 [18/Sep/2016:13:59:00 +0000] "PROPFIND /oct/oc91/remote.php/webdav/ HTTP/1.1" 207 1263 "-" "Mozilla/5.0 (Linux) mirall/2.2.3"
my-ip - user2 [18/Sep/2016:13:59:30 +0000] "PROPFIND /oct/oc91/remote.php/webdav/ HTTP/1.1" 207 5374 "-" "Mozilla/5.0 (Linux) mirall/2.2.3"
my-ip - user2 [18/Sep/2016:14:00:00 +0000] "PROPFIND /oct/oc91/remote.php/webdav/ HTTP/1.1" 207 1263 "-" "Mozilla/5.0 (Linux) mirall/2.2.3"
my-ip - user2 [18/Sep/2016:14:00:30 +0000] "PROPFIND /oct/oc91/remote.php/webdav/ HTTP/1.1" 207 1263 "-" "Mozilla/5.0 (Linux) mirall/2.2.3"
my-ip - user2 [18/Sep/2016:14:00:52 +0000] "PROPFIND /oct/oc91/remote.php/webdav/ HTTP/1.1" 207 1302 "-" "Mozilla/5.0 (Linux) mirall/2.2.3"
my-ip - user2 [18/Sep/2016:14:01:03 +0000] "GET /oct/oc91/ocs/v2.php/apps/notifications/api/v1/notifications?format=json HTTP/1.1" 200 1091 "-" "Mozilla/5.0 (Linux) mirall/2.2.3"
my-ip - user2 [18/Sep/2016:14:01:07 +0000] "PROPFIND /oct/oc91/remote.php/webdav/ HTTP/1.1" 207 1121 "-" "Mozilla/5.0 (Linux) mirall/2.2.3"
my-ip - user2 [18/Sep/2016:14:01:23 +0000] "PROPFIND /oct/oc91/remote.php/webdav/ HTTP/1.1" 207 1302 "-" "Mozilla/5.0 (Linux) mirall/2.2.3"
my-ip - user2 [18/Sep/2016:14:01:24 +0000] "GET /oct/oc91/ocs/v2.php/apps/notifications/api/v1/notifications?format=json HTTP/1.1" 200 948 "-" "Mozilla/5.0 (Linux) mirall/2.2.3"
my-ip - user2 [18/Sep/2016:14:01:26 +0000] "PROPFIND /oct/oc91/remote.php/webdav/ HTTP/1.1" 207 4020 "-" "Mozilla/5.0 (Linux) mirall/2.2.3"
my-ip - user2 [18/Sep/2016:14:01:26 +0000] "PROPFIND /oct/oc91/remote.php/webdav/folder HTTP/1.1" 207 2124 "-" "Mozilla/5.0 (Linux) mirall/2.2.3"
my-ip - user2 [18/Sep/2016:14:01:26 +0000] "PROPFIND /oct/oc91/remote.php/webdav/folder/folderB HTTP/1.1" 207 4093 "-" "Mozilla/5.0 (Linux) mirall/2.2.3"
my-ip - user2 [18/Sep/2016:14:01:26 +0000] "PROPFIND /oct/oc91/remote.php/webdav/folder/folderB/folderA HTTP/1.1" 207 2171 "-" "Mozilla/5.0 (Linux) mirall/2.2.3"
my-ip - user2 [18/Sep/2016:14:01:27 +0000] "GET /oct/oc91/remote.php/webdav/folder/folderB/folderA/test2.txt HTTP/1.1" 200 908 "-" "Mozilla/5.0 (Linux) mirall/2.2.3"
my-ip - user2 [18/Sep/2016:14:01:29 +0000] "PROPFIND /oct/oc91/remote.php/webdav/ HTTP/1.1" 207 4020 "-" "Mozilla/5.0 (Linux) mirall/2.2.3"
my-ip - user2 [18/Sep/2016:14:01:29 +0000] "DELETE /oct/oc91/remote.php/webdav/folder/folderB/folderA/test2.txt HTTP/1.1" 204 652 "-" "Mozilla/5.0 (Linux) mirall/2.2.3"
my-ip - user2 [18/Sep/2016:14:01:39 +0000] "PROPFIND /oct/oc91/remote.php/webdav/ HTTP/1.1" 207 1264 "-" "Mozilla/5.0 (Linux) mirall/2.2.3"

tflidd avatar Sep 19 '16 20:09 tflidd

@tflidd thanks for the steps. Can you just add a few more details.

share folder with them which contains folderA and folderB

Who is owning folder ? user1 or user2? What are the access rights? (read-only, or write access)

then move folder folderA into folder folderB

This has to be done from the web interface as user 1?

ogoffart avatar Sep 20 '16 08:09 ogoffart

I did the step (assuming folder was owned by user1, shared read-write. And I can reproduce the bug.

ogoffart avatar Sep 20 '16 08:09 ogoffart

Hi, i've teste again and i reproduce the bug without needing of sharing folder:

i've an user who is loged as lfontaine

1/ i create in local-folder the folder: FOLDERV 2/ i create a file in FOLDERV: filetest3.txt 3/ i resume (don't quit) the owncloud's client 4/ i connect web interface and modified filetest3.txt 5/ in web interface, i renamed FOLDERV: FOLDERV-RENAMED 6/ i cancel the resuming of owncloud's client 7/ my local's folder: FOLDERV is move in FOLDERV-RENAMED 8/ my owncloud's client download filetest3.txt and replace the older in FOLDERV-RENAMED 9/ my owncloud's client propagate server that the file filtest3.txt placed in folder FOLDERV is deleted 10/ the server misunderstand and delete filetest3.txt in FOLDERV-RENAMED 11/ the local's file filetest3.txt is delete

owncloud's client log below: log-deletion.txt

lfontaine35 avatar Sep 20 '16 09:09 lfontaine35

Fix in https://github.com/owncloud/client/pull/5195

ogoffart avatar Sep 20 '16 13:09 ogoffart

Works fine in 2.2.4. Following https://github.com/owncloud/client/issues/5192#issuecomment-248249526 steps.

SergioBertolinSG avatar Sep 23 '16 11:09 SergioBertolinSG

Hi, i don't understand where i can dowload 2.2.4 client? best regards

lfontaine35 avatar Sep 23 '16 11:09 lfontaine35

@lfontaine35 It will be released soon. I guess you can request a test client sending an email to [email protected] .

SergioBertolinSG avatar Sep 23 '16 13:09 SergioBertolinSG

Hi, I don't know wether I post at the right place, but I got a very similar problem. Client 2.2.3 on Mac OS 9.5 Server : ownCloud 9.1.0 (stable) on Ubuntu 14.04 ; PHP 5.5.9-1ubuntu4.19 ; mysql Ver 14.14 Distrib 5.5.52 We have had a file deleted on the server side, after renaming the folder containing it. I found in the log file strange things at the time the file was deleted (txt file provided). The file was named "rapport intermédiaire V1 RL.docx" and the folder has been changed from "Etude biblio" to "Etude partenariat université". log deleted file.txt (this is only an extract). After discussing with colleagues, it seems the same behavior already happened recently, but I did not find the log. The file was in the trashbin on the server, meaning that it had had time to be synchronized from my Macbook to the server. The log seems to contain only occurrence with the original name of the folder. The user "lolo" indicated in the log file is not the user who initially created the file. Therefore I am not sure that the log messages citing the deleted file are really related to the deletion.

What is strange also is that after I got back the file from the trashbin on the server, I put it back in the folder where it was originally and it did not synchronize. The error message in the client "activity" is: "Cet élément n'a pas été synchronisé en raison des erreurs précédentes : Error downloading https://drive.XXXX-YYYYY.com/remote.php/webdav/Rapport intermédiaire V1 RL.docx - server replied: Forbidden" (translation : this element has not been synchronized due to the following errors:).

I have tried to reproduce the phenomenon, creating a folder, adding a file, and changing the name of the folder during the synchronization, but I did not succeed.

By the way my log file is full of similar log, and weight 209 Mo in less than one week. We have 4 clients connected on the server, syncing one huge folder (and subfolders) of about 60 Go, but with rather few changes each day (less than 100 Mo).

Rene33 avatar Sep 27 '16 16:09 Rene33

@Rene33 the file deletion is probably this bug. The Forbidden error however seems unrelated.

ogoffart avatar Sep 28 '16 06:09 ogoffart

@ogoffart : however, the forbidden error was affecting the very same file which had been deleted. To let it synchronize, I had to move the file outside of the folder, and then to copy it back inside, with a new name... However I think the other problem I have (huge log file) is rather related to this other bug https://github.com/owncloud/core/issues/25557

Rene33 avatar Sep 28 '16 08:09 Rene33