-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Keep null in getMetaData in Checksum storage wrapper #29739
Conversation
Sounds like missing unit test somewhere :> Nice catch. |
@IljaN can you take over and add the missing tests ? Somehow it seems we missed checking for tests back in the checksum PR. There are already some example for storage wrapper unit tests. |
Checksums are covered by acceptance tests. But a UnitTest won`t hurt :) |
For the record, tested and fixes the referenced issue #29806 (comment) Seems that tests need a restart so we can go for a green and merge... |
@mmattel Thanks! I am in the process of adding some unit-tests. So no manual restart needed. |
We are running in to this exception in a versioning test with this fix: core/lib/private/Files/Cache/Scanner.php Lines 117 to 120 in 639986a
|
@IljaN if you're testing on actual FS, make sure that the "data/$userId/files" folder of the user exists as if the user had logged in before. Maybe some of previous running tests delete this and this test here expected it to exist without proper initialization. (happened before...) |
Yeah this test is actually quite brittle, runs just once locally and then throws user already exists error, will try to fix it |
4cfd6a8
to
760a938
Compare
@PVince81 you mentioned that there are some filesystem conditions which can cause null meta-data, who is in the know? If null can happen we either must refactor so that getMetaData never returns null and all codepaths (Scanner?) can work with an emtpy array. There are ~16 Usages of get MetaData Or we need to change the docs for the storage interface to allow null: core/lib/private/Files/Storage/Storage.php Lines 92 to 95 in f10d105
Should we create a follow up issue? |
@IljaN the only way I found currently to reproduce this issue was having a NFD-formatted file name on an external storage and running |
@PVince81 Not sure If I was clear enough: return null here fixes the issue:
...but violates storage interface getMetaData (should return array). |
Hmm... but it seems the underlying storage does return |
Yeah there are actually a few other sites which handle null from getMetaData calls, but I consider this a bug/incorrect implementation because the interface states that it should return array unless we change the doc. |
Example from above: core/lib/private/Files/Cache/Scanner.php Lines 117 to 120 in 639986a
|
Maybe some deeper layer returns null and this is propagated up so I would assume that the deeper layer should return an array, or the first wrapper which encounters null should pass an empty array up to the next wrapper. |
I suggest we look into this separately... maybe adjust the interfaces for null then. I think |
Codecov Report
@@ Coverage Diff @@
## master #29739 +/- ##
============================================
+ Coverage 60.52% 60.52% +<.01%
- Complexity 18380 18382 +2
============================================
Files 1090 1090
Lines 60949 60953 +4
============================================
+ Hits 36888 36892 +4
Misses 24061 24061
Continue to review full report at Codecov.
|
👍 for the unit tests. |
backport conflict with versions stuff, might be better to wait for backport of https://github.com/owncloud/core/pull/29257/files#diff-5ad1bbf2fd6f06e61ebecc59cd61a983L130 |
@DeepDiver1975 ping on this blocker, we can't backport without this. Or well we could backport only half of this and the rest later. Let me know. |
Lets chat in about two days again - I should have an understanding of the situation by then ;-) |
I made a backport of only the fix without the unit tests as the latter are blocked (see previous comments). PR here #30302 |
|
Now #30302 is a full backport of this + adjustments to make it work with stable10 |
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
Keep null in getMetaData in Checksum storage wrapper.
Not funny is that in PHP if you add an item into
null
as if it was an array, it suddenly becomes one...related #28181
fixes #28960
Related Issue
None raised. Discovered while debugging background scanner with size=-1 and I noticed that getMetaData() on a non-existing file returns not null but a partial array.
Motivation and Context
How Has This Been Tested?
Not tested yet.
Why is there no unit test class for the Checksum storage wrapper ?!! @IljaN
Screenshots (if appropriate):
Types of changes
Checklist:
TODO