-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Scanner repairs invalid path #28217
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
Scanner repairs invalid path #28217
Conversation
Whenever the path doesn't match the parent/child relationship, the path value is corrected in the oc_filecache table.
| } | ||
|
|
||
| // check if path / parent is inconsistent | ||
| if ($file !== $cacheData['path']) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does the path variable contains the whole file path or just the directory?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both contain a value relative to the user's home, like "files/folderA/one"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
|
Code looks fine. 👍 |
|
Thanks. I will not merge it yet because need to think of more twisted scenarios where the target entry to rename to already exists in oc_filecache. |
|
To check:
To decide:
|
|
side note:
|
|
|
Turns out that if you write anything inside the bogus "folderB/one/two" folder through Webdav, the code accesses it by a mechanism different than "path". And since the code finds out that the parent entry isn't in the oc_filecache, it automatically creates it. So it is indeed possible to block the target repair. Running the current code from this PR doesn't repair anything and the old entries stay there. If we decide to overwrite the new target (folderB/one/two) with the old source (folderA/one/two) then we lose the potentially new metadata that the user might have added. I think that the probability that the relevant metadata to keep is higher for the source "folderA/one/two", so we could use that... |
|
Oh... the reason why this PR doesn't fix anythting is because it does not find the problem while scanning, since there is no hole in the tree. So fixing the case I just mentioned above would require a completely different approach and location in the code. Maybe a repair step would be fine as it would run during an update and be done with it (assuming there is no other bug that recreates this broken situation) |
|
When we delete the target entry, if that one happens to have metadata already, we could try and move it to the source entry. Unfortunately this is complex and requires a lot of testing: this would require finding all shares, tags, etc assigned to the target's fileid and then changing that fileid to point to the source. And we can't cover third party apps. |
|
I don't want to waste too much time with this so let's go with this approach:
Having it in RepairStep form means it only runs once after an update, which might be ok for now. One can always rerun repair steps manually if any other kind of undiscovered bug recreates the broken situation. |
|
Uh oh... what if the storage value is not the same between parent and child ?
|
|
|
Obsoleted by #28253 |
|
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. |
Description
Whenever the path doesn't match the parent/child relationship, the path
value is corrected in the oc_filecache table.
Related Issue
Fixes the fallout created by the bug #28018
Motivation and Context
Because we hate filecache inconsistencies
How Has This Been Tested?
Run the steps from #28018.
Run the query from #28018 (comment) to find the broken entry.
Run
occ files:scan --allCheck the broken entry again: the path is corrected.
Screenshots (if appropriate):
Types of changes
Checklist:
TODOs: