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

fix moving folders out of a cache jail #5424

Merged
merged 4 commits into from
Jul 6, 2017
Merged

Conversation

icewind1991
Copy link
Member

Fixes #3502

@plrunner @mrieser @bat553 please verify if this fixes the problem for you

Signed-off-by: Robin Appelman <robin@icewind.nl>
@icewind1991 icewind1991 added the 3. to review Waiting for reviews label Jun 15, 2017
@icewind1991 icewind1991 added this to the Nextcloud 13 milestone Jun 15, 2017
@mention-bot
Copy link

@icewind1991, thanks for your PR! By analyzing the history of the files in this pull request, we identified @nickvergessen, @d--j and @rullzer to be potential reviewers.

@warnerbryce
Copy link

Hello @icewind1991

How can i test this fix i don't have this path in my cloud : tests/lib/Files/Cache/Wrapper/CacheJailTest.php

I have the CacheJail.php in lib/private/Files/Cache/Wrapper/

Does this CacheJailTest.php is necessary ?

@codecov
Copy link

codecov bot commented Jun 15, 2017

Codecov Report

Merging #5424 into master will decrease coverage by 22.9%.
The diff coverage is 0%.

@@              Coverage Diff              @@
##             master    #5424       +/-   ##
=============================================
- Coverage     54.15%   31.24%   -22.91%     
- Complexity    22349    22362       +13     
=============================================
  Files          1379     1380        +1     
  Lines         85557    85020      -537     
  Branches       1329     1329               
=============================================
- Hits          46331    26564    -19767     
- Misses        39226    58456    +19230
Impacted Files Coverage Δ Complexity Δ
lib/private/Files/Cache/Wrapper/CacheJail.php 0% <0%> (-87.81%) 38 <1> (+1)
version.php 0% <0%> (ø) 0 <0> (ø) ⬇️
lib/private/Repair/NC13/RepairInvalidPaths.php 0% <0%> (ø) 13 <13> (?)
lib/private/Repair.php 27.84% <0%> (-0.36%) 19 <0> (ø)
lib/private/Files/Mount/CacheMountProvider.php 0% <0%> (-100%) 4% <0%> (ø)
apps/user_ldap/lib/Mapping/UserMapping.php 0% <0%> (-100%) 1% <0%> (ø)
apps/files_sharing/lib/External/MountProvider.php 0% <0%> (-100%) 4% <0%> (ø)
lib/private/Files/Mount/LocalHomeMountProvider.php 0% <0%> (-100%) 1% <0%> (ø)
lib/private/Accounts/Hooks.php 0% <0%> (-100%) 14% <0%> (ø)
...ivate/Files/Cache/Wrapper/CachePermissionsMask.php 0% <0%> (-100%) 3% <0%> (ø)
... and 370 more

@LukasReschke
Copy link
Member

Does this CacheJailTest.php is necessary ?

This is only the unit test, it is not packaged within the final releases. So you don't have to replace that file, it's only for our automated tests relevant :)

nickvergessen
nickvergessen previously approved these changes Jun 16, 2017
@LukasReschke
Copy link
Member

@icewind1991 Can we have a repair step here? If possible a live repair step to not block the upgrade and in multiple smaller steps.

@nickvergessen nickvergessen dismissed their stale review June 16, 2017 10:56

after further testing seems to not work

Copy link
Member

@LukasReschke LukasReschke left a comment

Choose a reason for hiding this comment

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

This change works for me locally, but we need to have a way to repair older installations. But there's another desktop client bug … let me try to reproduce this and file to the client repo 🙈

@icewind1991
Copy link
Member Author

note that this issue is completely reproducible without the client by moving files from the web ui

@bat553
Copy link

bat553 commented Jun 20, 2017

I have not yet been able to apply the fix but I wanted to report that this bug also happened when we create a shared folder.

@icewind1991
Copy link
Member Author

@LukasReschke added repair step

@LukasReschke
Copy link
Member

@nickvergessen Can you review the repair step? THX!

@nickvergessen
Copy link
Member

@icewind1991 please write a unit test for the repair step.
Should be fairly easy?!

Signed-off-by: Robin Appelman <robin@icewind.nl>
@icewind1991
Copy link
Member Author

@nickvergessen done

@MorrisJobke
Copy link
Member

I updated this here to do:

  • move the repair step into a NC13 folder
  • add a version number check to only run the repair step once

Copy link
Member

@MorrisJobke MorrisJobke left a comment

Choose a reason for hiding this comment

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

Tested and works 👍 (also the repair step properly cleans it up)


public function run(IOutput $output) {
$versionFromBeforeUpdate = $this->config->getSystemValue('version', '0.0.0');
if (version_compare($versionFromBeforeUpdate, '13.0.0.1', '<')) {
Copy link
Member

Choose a reason for hiding this comment

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

Can we adjust this to either:

  • Use an appconfig value
  • Also check for 12.0.1 as we want to backport this one :)

Copy link
Member

Choose a reason for hiding this comment

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

Use an appconfig value

This needs to be cleaned up later.

Also check for 12.0.1 as we want to backport this one :)

Okay - if this is 12.0.1 then I will add it as well.

Signed-off-by: Morris Jobke <hey@morrisjobke.de>

use OC\Files\Cache\Cache;
use OC\Files\Storage\Temporary;
use OC\Repair\RepairInvalidPaths;
Copy link
Member

Choose a reason for hiding this comment

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

Test not passing, you moved that file 😉

@JiriMON
Copy link

JiriMON commented Jun 29, 2017

Seems to work ok for moving folders/files out of a cache jail, but still seeing some occurrences of duplicate files as #3502. Tested on 12.0.0.29 - manually backported from changed files.

Signed-off-by: Robin Appelman <robin@icewind.nl>
@jospoortvliet
Copy link
Member

Note that it results in lost data 😢 😱
I updated a file on my laptop but it doesn't sync to my desktop, even though both clients claim to be up to date.

@icewind1991
Copy link
Member Author

@LukasReschke please re-review

@ArtificialOwl
Copy link
Member

Tried to reproduce #3502 with linux client (2.3.2beta, build 13) and this branch. No can do. Works fine for me.

@MorrisJobke
Copy link
Member

Tried to reproduce #3502 with linux client (2.3.2beta, build 13) and this branch. No can do. Works fine for me.

Seeing as 👍 -> merging

@MorrisJobke MorrisJobke merged commit b4a221f into master Jul 6, 2017
@MorrisJobke MorrisJobke deleted the moveFromCache-from-shared branch July 6, 2017 16:31
@MorrisJobke
Copy link
Member

@icewind1991 please create the backport PR ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review Waiting for reviews
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Duplicated files and folders when moving from one shared folder to another (can reproduce it)
10 participants