Skip to content
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

empty path has no parents #31988

Merged
merged 1 commit into from
Jul 5, 2018
Merged

empty path has no parents #31988

merged 1 commit into from
Jul 5, 2018

Conversation

butonic
Copy link
Member

@butonic butonic commented Jul 4, 2018

what can I say ... 😞

Without this a public share, mounted as a federated share in the root of a users home will hav its etag overwritten with a uniqeid on every propfind, causing endless downloads.

How to reproduce:

  1. as user admin create a 1 byte txt file.
  2. share it as public link
  3. log out
  4. open the link
  5. add to the same oc instance
  6. log in as user test
  7. accept incoming share
  8. do a propfind against user test like
curl 'http://core/remote.php/dav/files/test/' -X PROPFIND --data-binary $'<?xml version="1.0"?>\n<d:propfind xmlns:d="DAV:" xmlns:oc="http://owncloud.org/ns">\n <d:prop>\n <d:getetag />\n <oc:fileid />\n <oc:permissions />\n <oc:size />\n </d:prop>\n</d:propfind>' --compressed -k -u test:123 -H 'Cookie: XDEBUG_SESSION=PHPSTORM' | xml_pp

Expected behavior:
multiple PROPFINDS give the same md5 etag

Actual behavior:
every propfind returns a new uniqueid

@butonic butonic added Type:Bug 3 - To Review app:files sev3-medium p2-high Escalation, on top of current planning, release blocker app:federation labels Jul 4, 2018
@PVince81 PVince81 added this to the QA milestone Jul 4, 2018
Copy link
Contributor

@PVince81 PVince81 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code makes sense, strange that this wasn't discovered before.

I'm also surprised that the logic in getParents() didn't result in an empty array.

Anyway, looks good and safe 👍

@PVince81 PVince81 modified the milestones: QA, development Jul 4, 2018
@PVince81
Copy link
Contributor

PVince81 commented Jul 4, 2018

PHP CS fixer unhappy and some tests fail

@butonic butonic force-pushed the empty-path-has-no-parents branch from 024c55f to 757a5d2 Compare July 4, 2018 19:10
@codecov
Copy link

codecov bot commented Jul 4, 2018

Codecov Report

Merging #31988 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master   #31988      +/-   ##
============================================
+ Coverage     63.49%   63.49%   +<.01%     
- Complexity    18545    18547       +2     
============================================
  Files          1167     1167              
  Lines         69544    69548       +4     
  Branches       1264     1264              
============================================
+ Hits          44155    44159       +4     
  Misses        25020    25020              
  Partials        369      369
Flag Coverage Δ Complexity Δ
#javascript 52.59% <ø> (ø) 0 <ø> (ø) ⬇️
#phpunit 64.74% <100%> (ø) 18547 <0> (+2) ⬆️
Impacted Files Coverage Δ Complexity Δ
lib/private/Files/Cache/Propagator.php 98.76% <100%> (+0.06%) 18 <0> (+2) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update db35412...e163543. Read the comment docs.

@butonic
Copy link
Member Author

butonic commented Jul 4, 2018

@PVince81 explode('/','') will return [''] not [] see http://php.net/manual/de/function.explode.php#99830 ... and we need '' as an element, so we cannot use array_filter ... well ... actually... no ... does not make sense

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
@butonic butonic force-pushed the empty-path-has-no-parents branch from 757a5d2 to e163543 Compare July 4, 2018 19:19
@PVince81
Copy link
Contributor

PVince81 commented Jul 5, 2018

damn... I see.

I'd like to find out why this wasn't discovered earlier. Maybe in most envs and scenarios the etag change somehow doesn't always affect syncing.

@PVince81 PVince81 merged commit 9c4857c into master Jul 5, 2018
@PVince81 PVince81 deleted the empty-path-has-no-parents branch July 5, 2018 07:29
@PVince81
Copy link
Contributor

PVince81 commented Jul 5, 2018

@butonic please backport, for 10.0.10

@butonic
Copy link
Member Author

butonic commented Jul 5, 2018

@PVince81 AFAICT only mounted public links to a file are represented with '' as the internal path. So only those are affected. And only since the zsync stuff has been merged, because it will do an is_file check on the file, causing the etag to be overwritten. So ... actuall seems to be a regression introduced with the zsync stuff.

@PVince81
Copy link
Contributor

PVince81 commented Jul 5, 2018

hmmm, but the zsync stuff is only on master ?

are you able to reproduce this on stable10 ?

@phil-davis
Copy link
Contributor

Backport stable10 #31992

@lock lock bot locked as resolved and limited conversation to collaborators Aug 28, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
3 - To Review app:federation app:files p2-high Escalation, on top of current planning, release blocker sev3-medium Type:Bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants