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
Creation of subfolders using desktop client after a move across shares can lead to duplicated folders. #28018
As user0 share folderA and folderB with user1.
Connect the desktop client using user1 and do:
Create folder 'one' in folderA.
Create folder 'two' in folderA/one.
Move 'folderA/one' subfolder to folderB.
Create folder 'three' in 'folderB/one/two' .
Access using the web ui using user0 or user1 and enter the folder folderB/one.
Expected behaviour
There is a folder 'two' inside 'folderB/one'.
Actual behaviour
Folder called 'two' is duplicated inside 'folderB/one' with the same name.
Server configuration
Operating system:
Ubuntu 14.04
Web server:
Apache
Database:
MySQL
PHP version:
7.0
ownCloud version: (see ownCloud admin page)
current master
{"installed":"true","maintenance":"false","needsDbUpgrade":"false","version":"10.0.2.0","versionstring":"10.0.2 RC1","edition":"Community","productname":"ownCloud"}
Updated from an older ownCloud or fresh install:
Fresh
The content of config/config.php:
Are you using external storage, if yes which one: local/smb/sftp/...
No.
changed the title [-]Duplication of folders while using dektop client when moving a folder across shares and creating new subfolders inside existing subfolders.[/-][+]Duplication of folders while using desktop client when moving a folder across shares and creating new subfolders inside existing subfolders.[/+]on May 26, 2017
changed the title [-]Duplication of folders while using desktop client when moving a folder across shares and creating new subfolders inside existing subfolders.[/-][+]Creation of subfolders using desktop client after a move across shares can lead to duplicated folders.[/+]on May 26, 2017
From what I see it goes to Updater::renameFromStorage() but fails to recognize that both come from the same wrapped storage (the one from user0). Inspecting shows that both have a different stored mount point which makes sense.
So this triggers the logic of $this->cache->moveFromCache which might be already. But there the paths look strange:
Just tried with moving from received shared folder to regular root, one of the paths is also absolute.
That must be because we're moving from a shared storage to home storage.
In the case of shared storage A to shared storage B, one of them is resolved to the home storage but not the other one.
Ok, I'm getting closer. In the cross-shared-storage move, both paths must be: $sourcePath='files/folderA/what and $targetPath='files/folderB/what'. Without this the SQL command cannot find all children within "folderA" so it doesn't move the children.
Now this is likely due to having one of the shared storages which was resolved back the to the home storage but not the other one. Or maybe the cache instance is not compatible with the storage.
this can be fixed manually by changing the path of the entry "31" to the one of the parent, so renaming "folderA" to "folderB": update oc_filecache set path='files/folderB/one/two', path_hash=md5(path) where fileid=31;
EDIT: ⚠️ I forgot to add the path_hash update, it's there now
Tried to find a way to update all such entries with a single SQL statement but can't because an UPDATE operation cannot select stuff at the same time on the same time in a subquery: https://stackoverflow.com/a/22378467
So the best would be to have PHP code that iterates over all the entries and repairs them. Additionally it would need to check whether the target path/entry doesn't already exist.
For the record: this is also reproducible if both shares come from two different users.
In that case the storage value will also be wrong in oc_filecache for the entry that has the wrong path.
Activity
[-]Duplication of folders while using dektop client when moving a folder across shares and creating new subfolders inside existing subfolders.[/-][+]Duplication of folders while using desktop client when moving a folder across shares and creating new subfolders inside existing subfolders.[/+][-]Duplication of folders while using desktop client when moving a folder across shares and creating new subfolders inside existing subfolders.[/-][+]Creation of subfolders using desktop client after a move across shares can lead to duplicated folders.[/+]PVince81 commentedon May 26, 2017
No need for desktop client. Just move using cadaver.
After step 6 I see this in the DB:
Looks like after moving "one" from the source the filecache entry is still there.
After step 7:
On disk:
So we have:
Running
occ files:scan --alldoes not fix the issue 😢PVince81 commentedon May 26, 2017
might also happen when moving between external storage mount points
PVince81 commentedon May 26, 2017
Hmm no, might be specific to shared storages.
From what I see it goes to
Updater::renameFromStorage()but fails to recognize that both come from the same wrapped storage (the one from user0). Inspecting shows that both have a different stored mount point which makes sense.So this triggers the logic of
$this->cache->moveFromCachewhich might be already. But there the paths look strange:The
$targetPathis absolute but$sourcePathis relative. That could be the issue...PVince81 commentedon May 26, 2017
Just tried with moving from received shared folder to regular root, one of the paths is also absolute.
That must be because we're moving from a shared storage to home storage.
In the case of shared storage A to shared storage B, one of them is resolved to the home storage but not the other one.
PVince81 commentedon May 26, 2017
Ok, I'm getting closer. In the cross-shared-storage move, both paths must be:
$sourcePath='files/folderA/whatand$targetPath='files/folderB/what'. Without this the SQL command cannot find all children within "folderA" so it doesn't move the children.Now this is likely due to having one of the shared storages which was resolved back the to the home storage but not the other one. Or maybe the cache instance is not compatible with the storage.
Needs further research.
PVince81 commentedon May 26, 2017
Fix is here #28022
PVince81 commentedon May 26, 2017
@SergioBertolinSG by the way, the cadaver thing I tested against the old dav endpoint.
From the fix it's not related to any specific dav endpoint as it's a core FS thing.
3 remaining items
PVince81 commentedon Jun 26, 2017
Fix still pending review #28022
PVince81 commentedon Jun 26, 2017
To fix the filecache, we likely need something that repairs parent-child relationships based on the path. Or the other way around: #22866 (comment)
PVince81 commentedon Jun 26, 2017
This query helps find out whether parent-child relationships are broken. In the case above:
PVince81 commentedon Jun 26, 2017
this can be fixed manually by changing the path of the entry "31" to the one of the parent, so renaming "folderA" to "folderB":
update oc_filecache set path='files/folderB/one/two', path_hash=md5(path) where fileid=31;EDIT:⚠️ I forgot to add the path_hash update, it's there now
PVince81 commentedon Jun 26, 2017
Tried to find a way to update all such entries with a single SQL statement but can't because an
UPDATEoperation cannot select stuff at the same time on the same time in a subquery: https://stackoverflow.com/a/22378467So the best would be to have PHP code that iterates over all the entries and repairs them. Additionally it would need to check whether the target path/entry doesn't already exist.
PVince81 commentedon Jun 26, 2017
Experimental repair routine that runs during files scan: #28217OBSOLETEPVince81 commentedon Jun 28, 2017
Another attempt at a better repair routine: #28253
PVince81 commentedon Jun 28, 2017
For the record: this is also reproducible if both shares come from two different users.
In that case the storage value will also be wrong in oc_filecache for the entry that has the wrong path.
PVince81 commentedon Jun 30, 2017
Apparently also reproducible by simply moving a folder that has subfolders out of a received share:
PVince81 commentedon Jul 3, 2017
Observed in v10.0.2, v9.1.4, v9.1.0, v9.0.10, v9.0.0.
Does not occur on v8.2.11.
Likely related to recent shared storage related refactorings.
PVince81 commentedon Jul 3, 2017
Repair step coming close to completion: #28253
lock commentedon Aug 1, 2019
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.