Skip to content

[Discovery] Fix possible issue with retrieval of permissions from the server #4548

Closed

Description

Activity

  1. added
    p2-high
    on Mar 8, 2016
  2. added this to the milestone on Mar 8, 2016
  3. ckamm commented on Mar 14, 2016

    @ckamm
    Contributor

    I have verified the code that reads remotePerm from the database. The csync_file_stat_t is nulled correctly and a NULL db value leads to an empty remotePerm, as expected.

  4. ckamm commented on Mar 14, 2016

    @ckamm
    Contributor

    Relevant lines from the logs at https://gist.github.com/nickvergessen/8f5b8ea746a32a7a934b:

    step03:
    SyncJournalFileRecord("owner_worker/dir") 
    "INSERT OR REPLACE INTO metadata (remotePerm) VALUES ("")
    
    step05:
    csync_walker:  directory: owner_worker/dir
    _csync_detect_update:  Database entry found, compare:   <-> RDNVW
    
  5. ckamm commented on Mar 14, 2016

    @ckamm
    Contributor

    @nickvergessen This is still confusing. It looks like step03 writes NULL, but step05 reads "RDNVW". Could you verify that this is what's going on by running the test only after step03 and then checking the database?

    Use something like sqlitebrowser on .csync_journal.db in the sync directory and then look for the "dir" row in the metadata table. What's the value of the remotePerm column?

  6. nickvergessen commented on Mar 14, 2016

    @nickvergessen
    Contributor

    The permissions are saved as RDNVW in the DB after step 3.
    Running oc_sync a second time would fix the faulty permissions.

  7. ckamm commented on Mar 15, 2016

    @ckamm
    Contributor
  8. assigned and unassigned on Mar 15, 2016
  9. ckamm commented on Mar 15, 2016

    @ckamm
    Contributor

    I think the problem is this code in SqlQuery::bindValue

                    // unbound value create a null entry.
                    res = SQLITE_OK;
    

    i.e. we don't call sqlite3_bind_null() when we want to produce a null table entry. Since bindings are not cleared by sqlite3_reset() the previous file's bindings are inadvertantly written to the database.

    I'll try to reproduce the problem and will then fix it.

  10. added
    ReadyToTest
    on Mar 15, 2016
  11. nickvergessen commented on Mar 15, 2016

    @nickvergessen
    Contributor

    I just built a new master client, so it includes 7bd4f95

    Fixed the issue and my locking test finally passes in all cases 👍

  12. added a commit that references this issue on Mar 15, 2016
  13. dragotin commented on Mar 15, 2016

    @dragotin
    Contributor

    great finding @ckamm and @nickvergessen thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

ReadyToTestp2-hightype:bug

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions