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

Lost share when transferring files to recipient #31150

Closed
PVince81 opened this issue Apr 16, 2018 · 19 comments
Closed

Lost share when transferring files to recipient #31150

PVince81 opened this issue Apr 16, 2018 · 19 comments
Assignees
Labels
blue-ticket p2-high Escalation, on top of current planning, release blocker Type:Bug
Milestone

Comments

@PVince81
Copy link
Contributor

Steps

  1. Create two users "user1" and "user2"
  2. Login as "user1"
  3. Create folder "foo/test"
  4. Share "foo" with "user2"
  5. Login as "user2"
  6. Share the received "foo/test" with link
  7. Log out
  8. On the CLI: occ files:transfer-ownership user1 user2
  9. Login as "user2"
  10. Find the "test" folder in the "transferred from" folder
  11. Check link share

Expected result

Link share preserved

Actual result

Link share completely lost, even removed from oc_share table.

Version

10.0.8 RC1

Discovered while testing #30161

@ownclouders
Copy link
Contributor

GitMate.io thinks possibly related issues are #13671 (Versions lost when moving file into shared folder as recipient), #22594 (Meta data lost when recipient restores a file), #13307 (Move shared file into shared folder as recipient, moved share info lost), #16225 (Files_texteditor gets frozen when a user tries to open a shared file as recipient which was deleted), and #15468 (Files stop being shared after a recipient restores them to previous versions).

@PVince81
Copy link
Contributor Author

setting to p2 as data loss is bad

@PVince81 PVince81 added p2-high Escalation, on top of current planning, release blocker and removed p3-medium Normal priority labels Apr 17, 2018
@PVince81
Copy link
Contributor Author

talked with @felixboehm and we're going to revert the original fix as the effect is less critical

then move ticket to 10.0.9 for a proper full fix

@PVince81
Copy link
Contributor Author

Revert PR is here for stable10: #31164

@PVince81
Copy link
Contributor Author

The revert doesn't solve the issue.

@sharidas will try to find a solution. I expect it to be non-intrusive and should not affect QA testing efforts. If a solution is found in time we can consider putting it in RC3 if a RC3 is deemed necessary.

@pmaier1 @felixboehm FYI

@PVince81
Copy link
Contributor Author

Investigated with @sharidas: the public link has a "parent" field pointing to the regular share.
When we delete the regular share, the link share is deleted as well as the parent is gone.
The reason we delete the regular share from "user1" to "user2" is because "user2" becomes the owner, so the share in question isn't necessary any more.

@sharidas is investigating if there is a good way to deparent the reshare so it can continue to exist, with a solution within the boundaries of the current sharing API.

@PVince81
Copy link
Contributor Author

the parent relationship is not exposed over API

Another idea is to add a new method ShareManager::transferShare($share, $newOwner) and move all the transfer logic there and add the part about reshare parents. This is a better approach because normally the transfer ownership command should not know anything about shares and rely on the share manager/provider to execute the operation. Remember, share manager/provider is an abstraction and third parties can provide their own which would also need to implement a method about transferring their shares.

@PVince81 PVince81 modified the milestones: QA, development Apr 18, 2018
@PVince81 PVince81 added p3-medium Normal priority and removed p2-high Escalation, on top of current planning, release blocker labels May 24, 2018
@PVince81 PVince81 modified the milestones: development, backlog May 28, 2018
@PVince81
Copy link
Contributor Author

to be rescheduled

@PVince81
Copy link
Contributor Author

I misunderstood, this was close to completion and just got finished. Closing

@PVince81 PVince81 modified the milestones: development, QA Jun 13, 2018
@PVince81 PVince81 reopened this Jun 26, 2018
@PVince81 PVince81 added p2-high Escalation, on top of current planning, release blocker and removed p3-medium Normal priority labels Jun 26, 2018
@sharidas
Copy link
Contributor

In the above scenario, the deletion of share at https://github.com/owncloud/core/blob/stable10/lib/private/Share20/Manager.php#L730.
Which internally calls deletion of children at https://github.com/owncloud/core/blob/stable10/lib/private/Share20/Manager.php#L978.

I was having a thought of processing public links first. But this code path suggests that it doesn't give any upper edge if we process public links first and the remaining shares at the last.

@sharidas
Copy link
Contributor

Manual testing of scenario #31150 (comment) still fails when the git HEAD is pointed to commit ( git reset ) representing this pr #31176

@sharidas
Copy link
Contributor

Would it be a bad solution if the deleteShare() (here -> https://github.com/owncloud/core/blob/stable10/lib/private/Share20/Manager.php#L962 ) is allowed to exclude some of its children? May be pass the types of children that we want to exclude. And the same argument to be passed to deleteChildren() https://github.com/owncloud/core/blob/stable10/lib/private/Share20/Manager.php#L913
And then in the deleteChildren loop just ignore the type and continue.

If the exclude list is empty the behaviour of deleteShare() or deleteChildren() would be same as we have now.

@PVince81
Copy link
Contributor Author

Not sure if it would be a good idea, because it means you'd have orphaned entries in the DB where the "parent" value points nowhere. If we had foreign key contraints it would be stricly forbidden by the DB.

How about gathering the list of children before doing any deletion ? Then transfer the children. Once the transfer is done, proceed with deletion.

@PVince81
Copy link
Contributor Author

the latter would require two iteration over the user's share but I don't expect a single user to have 10000+ shares so it should be ok

@sharidas
Copy link
Contributor

Not sure if it would be a good idea, because it means you'd have orphaned entries in the DB where the "parent" value points nowhere. If we had foreign key contraints it would be stricly forbidden by the DB.

Yes the orphaned entries in the DB was pulling me back from this idea.

How about gathering the list of children before doing any deletion ? Then transfer the children. Once the transfer is done, proceed with deletion.

didn't quite get by 'transfer the children'

@sharidas
Copy link
Contributor

How about gathering the list of children before doing any deletion ? Then transfer the children. Once the transfer is done, proceed with deletion.

Ok so if I understood correctly for 'transfer the children' -> Create new share from the child share. And then proceed with the deletion.

@PVince81
Copy link
Contributor Author

or just update the child share to not have a parent value any more ? whatever you already did in the current code, but do it earlier ?

@sharidas
Copy link
Contributor

Created a WIP PR -> #31924.

@lock
Copy link

lock bot commented Jul 30, 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.

@lock lock bot locked as resolved and limited conversation to collaborators Jul 30, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
blue-ticket p2-high Escalation, on top of current planning, release blocker Type:Bug
Projects
None yet
Development

No branches or pull requests

4 participants