Skip to content

Empty etag after moving shared file into a commonly received share #20769

Closed

Description

@PVince81

Steps to reproduce

  1. Setup v8.2.1 with "root" as the admin
  2. Create two users "user1" and "user2"
  3. Add "root", "user1" and "user2" into a new group "users"
  4. Login as "root"
  5. Create a folder "common/sub"
  6. Share "common" with "users"
  7. Login as "user1"
  8. Create a non-empty text file "test.txt" with some contents using the text editor
  9. Share "test.txt" with "user2"
  10. Login as "user2"
  11. Check that the file is there
  12. Login as "user1" again
  13. In the web UI, move "test.txt" into "common"
  14. Then move "test.txt" into "common/sub"
  15. View the text file: contents still exist
  16. Check the database entry for test.txt
  17. Login as "user2"
  18. Check the database entry for test.txt
  19. View or download the received file share still in the root "/test.txt"

Expected result

File can be downloaded and synced.

Actual result

File is broken and empty when opened as receiver.
Before the last login as "user2" the etag still exists in the database.
As soon as "user2" logs in, the etag becomes NULL:

MariaDB [owncloud]> select * from oc_filecache where path like '%test%';
+--------+---------+---------------------------+----------------------------------+--------+----------+----------+----------+------+------------+---------------+-----------+------------------+------+-------------+
| fileid | storage | path                      | path_hash                        | parent | name     | mimetype | mimepart | size | mtime      | storage_mtime | encrypted | unencrypted_size | etag | permissions |
+--------+---------+---------------------------+----------------------------------+--------+----------+----------+----------+------+------------+---------------+-----------+------------------+------+-------------+
|     19 |       1 | files/common/sub/test.txt | 9fa03663cc736121e08e4f487f0d3bec |     10 | test.txt |        7 |        7 |    0 | 1448556624 |    1448556624 |         0 |                0 | NULL |          23 |
+--------+---------+---------------------------+----------------------------------+--------+----------+----------+----------+------+------------+---------------+-----------+------------------+------+-------------+

This might be triggered by the share grouping logic ?

Also note that if instead of "common/sub" you only use "common", the etag stays intact but the file is still broken, and after a few file manipulations the etag becomes NULL too.

And, if as "user2" you move "test.txt" in a local non-shared subfolder, POOF the file vanishes!

Versions

Observed in v8.2.0 and v8.2.1

@rullzer @schiesbn

Activity

  1. added this to the milestone on Nov 26, 2015
  2. PVince81 commented on Nov 26, 2015

    @PVince81
    ContributorAuthor

    Also observed on master 60682e1

  3. PVince81 commented on Nov 26, 2015

    @PVince81
    ContributorAuthor

    On 8.1.4 the same steps also result in an empty file, but the etag was not set to null (might be luck though)

  4. PVince81 commented on Nov 26, 2015

    @PVince81
    ContributorAuthor

    In 8.0.9 the file does NOT appear at all in the root of "user2", the received share is correctly merged (share merge) together and "user2" only sees the merged file inside "common/sub".

    So we could say this is a regression from OC 8.

  5. PVince81 commented on Nov 26, 2015

    @PVince81
    ContributorAuthor

    @cmonteroluque FYI

  6. PVince81 commented on Nov 27, 2015

    @PVince81
    ContributorAuthor

    Also looks like it removed the delete permission. It almost looks like if it share fileinfo entry got mixed up with the actual fileinfo entry.

  7. PVince81 commented on Nov 27, 2015

    @PVince81
    ContributorAuthor

    Apparently it seems to break the versions too 😦 (the files are 0 bytes too)

  8. rullzer commented on Dec 1, 2015

    @rullzer
    Contributor

    So it seems the file is not destroyed on disk... (which is at least something)

  9. rullzer commented on Dec 1, 2015

    @rullzer
    Contributor

    Ok I got it. This happens for the following reason I think:

    At step 11 user1 transfers ownership of the file to the user root.
    This means that at that point the share user1 has with user2 is effectively a reshare. And if I update the database right before point 15 everything works out.

    So we need to update the parent of the file.

  10. rullzer commented on Dec 1, 2015

    @rullzer
    Contributor

    We might be able to set the parent correctly when we listen for the rename hook....

  11. rullzer commented on Dec 1, 2015

    @rullzer
    Contributor

    But.... do we actually want to allow this. If you hava a file commong/foo.txt and you try to share that with user2 we do not allow it.

    We could also say we do not allow moving of shared files into received shares.

  12. 13 remaining items

  13. modified the milestones: , on Dec 9, 2015
  14. added 4 commits that reference this issue on Dec 10, 2015
    0dae2b8
    5280d01
    643778b
  15. brozkeff commented on Dec 21, 2015

    @brozkeff

    I performed exactly the test as PVince81 outlined in Steps to reproduce at the beginning on a cloned production VPS where I upgraded owncloud from 7 (production version) gradually to 8, 8.1, 8.2.1 and then switched repository to 8.2 testing and upgraded via sudo apt-get update && sudo apt-get install owncloud to 8.2.2~RC1-24.1

    After logging as user2 I see the text file twice:

    • in the root folder, where next to the sharing icon I see "user1" and when clicking on the icon I see in Activity that "user1 shared" few mins ago.
    • in the common/sub subfolder, where next to the sharing icon i see "root" but when I click on this icon there is no longer any mention of "root" but instead also the "user1 shared" few mins ago.

    The contents of the file is OK, and the fact the file is visible twice makes some sense, because the file is shared indirectly via root to whole group (sharing common/sub inclucing everything inside even things user1 moved there at some point), and directly via user1 by manually sharing that particular file to user2. But there is a slight mismatch between the name of the owner of the containing folder written next to the icon, and the info in Sharing and Activity section to that file.

    Screenshot:
    http://i63.tinypic.com/2i8yziw.png

    After all the steps database query looks like this:

    select * from oc_filecache where path like '%file.txt%'
    
    fileid  storage path    path_hash   parent  name    mimetype    mimepart    size    mtime   storage_mtime   encrypted   unencrypted_size    etag    permissions
    181890  1   files/common/sub/file.txt   aaa4c9baab4eb69a63a388fefd068be4    181889  file.txt    22  18  36  1450708676  1450708676  0   0   18bbe0380848811f110464adcae049f4    27
    
  16. PVince81 commented on Dec 21, 2015

    @PVince81
    ContributorAuthor

    @brozkeff in your screenshot you ask "shouldn't it be the same ?".

    I think the activity app will not be notified of the special manipulation that was done internally, so the activity you see here might still be the old one. I'm not sure whether this is fixable. Maybe a new activity should be created after the reparenting operation, if possible ? (something for a separate ticket though)

    CC @nickvergessen

  17. nickvergessen commented on Jan 4, 2016

    @nickvergessen
    Contributor

    If you think there is an issue with the activity, please create a separate issue. But yes, moving files does not retroactivly update all paths in activities

  18. lock commented on Aug 7, 2019

    @lock

    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.

  19. locked as resolved and limited conversation to collaborators on Aug 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions