client icon indicating copy to clipboard operation
client copied to clipboard

Non-deterministic behaviour with the sync client on windows and files differing by case

Open yolanda93 opened this issue 9 years ago • 4 comments

Steps to reproduce

  1. Install owncloud 9.1.4
  2. Run smashbox: https://github.com/yolanda93/smashbox/tree/case_conflicts The test is implemented in: https://github.com/yolanda93/smashbox/blob/case_conflicts/lib/test_caseconflicts.py

Test caseconflicts

  1. This test is going to create the following files on the server: ['TestCaseConflicts', 'testcaseconflicts', 'testCaseConflicts', 'testcaseConflicts', 'TestcaseConflicts', 'Testcaseconflicts', 'TestCaseconflicts', 'testCaseconflicts' ]
  2. The files are synchronized into empty local sync folders.

Expected behaviour

  • Unix All the files are synchronized. ['TestCaseConflicts', 'testcaseconflicts', 'testCaseConflicts', 'testcaseConflicts', 'TestcaseConflicts', 'Testcaseconflicts', 'TestCaseconflicts', 'testCaseconflicts' ]
  • Windows Only one file is downloaded since Windows file system is case insensitive. This file is always the same. ['TestCaseConflicts']

Actual behaviour

Windows Only one file is downloaded since it is case insensitive. This file is NOT always the same. Local files after sync0: 'TestCaseConflicts' Local files after sync1: 'testCaseconflicts' Local files after sync2: 'Testcaseconflicts' Local files after sync3: 'testCaseConflicts' .......

Logs

Smashbox logs

********************************************************************************
(1) creator:  PREPARATION
********************************************************************************
INFO:root:entering new step 
********************************************************************************
(2) creator:  ADD 8 FILES WITH CONFLICT CASE FILENAMES ON THE SERVER
********************************************************************************
INFO:root:The following files has been created ['TestCaseConflicts', 'testcaseconflicts', 'testCaseConflicts', 'testcaseConflicts', 'TestcaseConflicts', 'Testcaseconflicts', 'TestCaseconflicts', 'testCaseconflicts']
INFO:root:entering new step 
********************************************************************************
(3) creator:  SYNC AND CHECK IF SOME FILES ARE LOST OR DUPLICATES
********************************************************************************
INFO:root:The following files has been downloaded by the creator set(['.testCaseconflicts.~1053', '.testCaseConflicts.~4d3c', '.TestcaseConflicts.~29cc', 'TestCaseConflicts', '.TestCaseconflicts.~7546', '.Testcaseconflicts.~1e75'])
2017-06-28 17:34:20,207 - ERROR - creator - There are 7 files lost. The filenames are ['testcaseconflicts', 'testCaseConflicts', 'testcaseConflicts', 'TestcaseConflicts', 'Testcaseconflicts', 'TestCaseconflicts', 'testCaseconflicts']  error_check(len(lost_files)==0,"There are %d files lost. The filenames are %s " % (len(lost_files),str(lost_files))) failed in creator() ["C:\Users\ydelahoz\workspace\smashbox\lib\test_caseconflicts.py" at line 114]
2017-06-28 17:34:20,209 - ERROR - creator - There are 5 extra files. The filenames are ['.testCaseconflicts.~1053', '.testCaseConflicts.~4d3c', '.TestcaseConflicts.~29cc', '.TestCaseconflicts.~7546', '.Testcaseconflicts.~1e75'] error_check(len(extra_files)==0,"There are %d extra files. The filenames are %s"  % (len(extra_files),str(extra_files))) failed in creator() ["C:\Users\ydelahoz\workspace\smashbox\lib\test_caseconflicts.py" at line 116]
INFO:root:entering new step 
********************************************************************************
(4) downloader06:  SYNC AND CHECK IF THE SAME FILES ARE DOWNLOADED IN A DIFFERENT DIRECTORY
********************************************************************************
INFO:root:entering new step 
********************************************************************************
(4) downloader01:  SYNC AND CHECK IF THE SAME FILES ARE DOWNLOADED IN A DIFFERENT DIRECTORY
********************************************************************************
INFO:root:entering new step 
********************************************************************************
(4) downloader05:  SYNC AND CHECK IF THE SAME FILES ARE DOWNLOADED IN A DIFFERENT DIRECTORY
********************************************************************************
INFO:root:entering new step 
********************************************************************************
(4) downloader04:  SYNC AND CHECK IF THE SAME FILES ARE DOWNLOADED IN A DIFFERENT DIRECTORY
********************************************************************************
INFO:root:entering new step 
********************************************************************************
(4) downloader02:  SYNC AND CHECK IF THE SAME FILES ARE DOWNLOADED IN A DIFFERENT DIRECTORY
********************************************************************************
INFO:root:entering new step 
********************************************************************************
(4) downloader07:  SYNC AND CHECK IF THE SAME FILES ARE DOWNLOADED IN A DIFFERENT DIRECTORY
********************************************************************************
INFO:root:entering new step 
********************************************************************************
(4) downloader08:  SYNC AND CHECK IF THE SAME FILES ARE DOWNLOADED IN A DIFFERENT DIRECTORY
********************************************************************************
INFO:root:entering new step 
********************************************************************************
(4) downloader:  SYNC AND CHECK IF THE SAME FILES ARE DOWNLOADED IN A DIFFERENT DIRECTORY
********************************************************************************
INFO:root:entering new step 
********************************************************************************
(4) downloader03:  SYNC AND CHECK IF THE SAME FILES ARE DOWNLOADED IN A DIFFERENT DIRECTORY
********************************************************************************
INFO:root:The files set(['.Testcaseconflicts.~1672', '.TestCaseconflicts.~1d38', '.TestcaseConflicts.~40ed', '.TestCaseConflicts.~1bf3', 'testCaseconflicts', '.testCaseConflicts.~6e66']) has been downloaded
2017-06-28 17:34:27,026 - ERROR - downloader05 - The files ['testCaseconflicts'] are now downloaded and previously not error_check(len(equal_files)==0,"The files %s are now downloaded and previously not" % str(equal_files)) failed in downloader() ["C:\Users\ydelahoz\workspace\smashbox\lib\test_caseconflicts.py" at line 135]
INFO:root:The files set(['.Testcaseconflicts.~1672', '.TestCaseconflicts.~1d38', '.TestcaseConflicts.~40ed', '.testCaseconflicts.~4dae', 'TestCaseConflicts', '.testCaseConflicts.~6e66']) has been downloaded
INFO:root:The files set(['.TestCaseconflicts.~1d38', '.testCaseconflicts.~4dae', '.TestcaseConflicts.~40ed', '.TestCaseConflicts.~1bf3', 'Testcaseconflicts', '.testCaseConflicts.~6e66']) has been downloaded
2017-06-28 17:34:30,038 - ERROR - downloader07 - The files ['Testcaseconflicts'] are now downloaded and previously not error_check(len(equal_files)==0,"The files %s are now downloaded and previously not" % str(equal_files)) failed in downloader() ["C:\Users\ydelahoz\workspace\smashbox\lib\test_caseconflicts.py" at line 135]
INFO:root:The files set(['.Testcaseconflicts.~1672', '.testCaseconflicts.~4dae', '.TestcaseConflicts.~40ed', '.TestCaseConflicts.~1bf3', 'TestCaseconflicts', '.testCaseConflicts.~6e66']) has been downloaded
2017-06-28 17:34:30,440 - ERROR - downloader01 - The files ['TestCaseconflicts'] are now downloaded and previously not error_check(len(equal_files)==0,"The files %s are now downloaded and previously not" % str(equal_files)) failed in downloader() ["C:\Users\ydelahoz\workspace\smashbox\lib\test_caseconflicts.py" at line 135]
INFO:root:The files set(['.Testcaseconflicts.~1672', '.testCaseconflicts.~4dae', '.TestcaseConflicts.~40ed', '.TestCaseConflicts.~1bf3', 'TestCaseconflicts', '.testCaseConflicts.~6e66']) has been downloaded
2017-06-28 17:34:32,450 - ERROR - downloader06 - The files ['TestCaseconflicts'] are now downloaded and previously not error_check(len(equal_files)==0,"The files %s are now downloaded and previously not" % str(equal_files)) failed in downloader() ["C:\Users\ydelahoz\workspace\smashbox\lib\test_caseconflicts.py" at line 135]
INFO:root:The files set(['.Testcaseconflicts.~1672', '.TestCaseconflicts.~1d38', '.TestcaseConflicts.~40ed', '.TestCaseConflicts.~1bf3', '.testCaseconflicts.~4dae', 'testCaseConflicts']) has been downloaded
2017-06-28 17:34:32,851 - ERROR - downloader03 - The files ['testCaseConflicts'] are now downloaded and previously not error_check(len(equal_files)==0,"The files %s are now downloaded and previously not" % str(equal_files)) failed in downloader() ["C:\Users\ydelahoz\workspace\smashbox\lib\test_caseconflicts.py" at line 135]
INFO:root:The files set(['.TestCaseconflicts.~1d38', '.testCaseconflicts.~4dae', '.TestcaseConflicts.~40ed', '.TestCaseConflicts.~1bf3', 'Testcaseconflicts', '.testCaseConflicts.~6e66']) has been downloaded
2017-06-28 17:34:33,513 - ERROR - downloader08 - The files ['Testcaseconflicts'] are now downloaded and previously not error_check(len(equal_files)==0,"The files %s are now downloaded and previously not" % str(equal_files)) failed in downloader() ["C:\Users\ydelahoz\workspace\smashbox\lib\test_caseconflicts.py" at line 135]
INFO:root:The files set(['.Testcaseconflicts.~1672', '.TestCaseconflicts.~1d38', '.TestcaseConflicts.~40ed', '.testCaseconflicts.~4dae', 'TestCaseConflicts', '.testCaseConflicts.~6e66']) has been downloaded
INFO:root:The files set(['.TestCaseconflicts.~1d38', '.testCaseconflicts.~4dae', '.TestcaseConflicts.~40ed', '.TestCaseConflicts.~1bf3', 'Testcaseconflicts', '.testCaseConflicts.~6e66']) has been downloaded
2017-06-28 17:34:35,428 - ERROR - downloader - The files ['Testcaseconflicts'] are now downloaded and previously not error_check(len(equal_files)==0,"The files %s are now downloaded and previously not" % str(equal_files)) failed in downloader() ["C:\Users\ydelahoz\workspace\smashbox\lib\test_caseconflicts.py" at line 135]

yolanda93 avatar Jun 29 '17 14:06 yolanda93

To be sure I understand: In the initial sync, which file gets downloaded amongst the set of files with the same case folded name is unspecified. But then , in the following sync, the file that is downloaded does not change.

The reason for the fact that it is unspecified is that we do the check only in the propagation phase. Once before downloading a file, and once after. For the first sync, since there is no files on the local directory, the propagator goes ahead and download every files, in parallel. Whatever files get downloaded first wins.

(That's why the t8.pl test sets the OWNCLOUD_MAX_PARALLEL to 1.)

However, is that really a bug. If you want determinism, you can set OWNCLOUD_MAX_PARALLEL to 1

One could argue that we could test that there are no two files with the same case folded name in the set of files we need to download and that we should not do the actual request to the server. But overall I don't think it's a big problem.

ogoffart avatar Jul 03 '17 10:07 ogoffart

I was more worried about syncing on different “fresh” folders. The test is downloading files on one folder and then creating separate new fresh folders and syncing for first time on these folders. I am checking if the file that I got on these fresh new folders is the same as the one that I got previously on the different folder created before.

For example, working on a device A will give me TestCaseConflicts file to write some content on it. If I go to another device B I expect to be able to sync and access the TestCaseConflicts file that I modified on device A, instead I got TestCaseconflicts (with no content on it) and I can not access the file TestCaseConflicts that I modified before.

From the user perspective of view I think that it is a little bit confusing. One solution could be check what was the file that was previously downloaded/modified on one folder and sync that file on other fresh devices/folders also ( no previous downloaded files here ), so the user can access that file. On the other hand, I don't see very practical setting OWNCLOUD_MAX_PARALLEL to 1 since it will result in a lower performance.

If it is not possible to solve this easily, I will vote for checking that there are no two files with the same case folded name as you said, so at least we don’t have a confusing behaviour for the user =)

yolanda93 avatar Jul 04 '17 07:07 yolanda93

Puh, some interop challenges continue ... Not a bug, its currently designed like that. In reality the number of such cross-platform conflicts is rather seldom. Would you mind checking how Dropbox deals with this?

hodyroff avatar Jul 08 '17 05:07 hodyroff

case-resolution handling is rather edgy and there's many stuff happening under the hood; let's recap:

Start with a clean client:

  1. Create 2 folders with the same name but different case on the webUI
  2. Sync with the client - case sensitivity clash error raised, the 2 folders appear checked on the selective sync list and its contents are not refreshed over time while the error lasts (size changes on the folders, new folders created on the server side...)
  3. Error overlay for the folder that caused the clash (contents get sync'ed)
  4. Rename the uncased folder - Files are transferred from the first location into this one in the server (sync propagates and merges the 2 folders) and the cased folder is deleted in server

I'll go with dynamically unchecking the folder not downloaded on the selective-sync list to avoid the error on the client side - display a warning about the collision instead. I think the problem with the selective sync list not being updated while there's errors was reported somewhere; @ogoffart @guruz any clue?

SamuAlfageme avatar Nov 28 '17 15:11 SamuAlfageme