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

Read fresh metadata for unmodified files #2252

Merged
merged 3 commits into from
Apr 25, 2019
Merged

Read fresh metadata for unmodified files #2252

merged 3 commits into from
Apr 25, 2019

Conversation

fd0
Copy link
Member

@fd0 fd0 commented Apr 24, 2019

What is the purpose of this change? What does it change?

Restic took all metadata for files which were detected as unmodified, not
taking into account changed metadata (ownership, mode). This PR corrects it,
only the list of blobs (=the content) is taken from the previous file, the
metadata is read anew.

Was the change discussed in an issue or in the forum before?

Closes #2249

Checklist

  • I have read the Contribution Guidelines
  • I have added tests for all changes in this PR
  • I have added documentation for the changes (in the manual)
  • There's a new file in changelog/unreleased/ that describes the changes for our users (template here)
  • I have run gofmt on the code in all commits
  • All commit messages are formatted in the same style as the other commits in the repo
  • I'm done, this Pull Request is ready for review

@fd0 fd0 changed the title Only take list of blobs for unmodified files Read fresh metadata for unmodified files Apr 24, 2019
@codecov-io
Copy link

codecov-io commented Apr 24, 2019

Codecov Report

Merging #2252 into master will increase coverage by 0.11%.
The diff coverage is 60%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2252      +/-   ##
==========================================
+ Coverage    50.8%   50.91%   +0.11%     
==========================================
  Files         178      178              
  Lines       14530    14533       +3     
==========================================
+ Hits         7382     7400      +18     
+ Misses       6080     6059      -21     
- Partials     1068     1074       +6
Impacted Files Coverage Δ
internal/archiver/archiver.go 68.35% <60%> (-0.27%) ⬇️
internal/checker/checker.go 70.25% <0%> (+3.66%) ⬆️

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 c776245...4f45b14. Read the comment docs.

@fd0 fd0 merged commit 4f45b14 into master Apr 25, 2019
fd0 added a commit that referenced this pull request Apr 25, 2019
Read fresh metadata for unmodified files
@fd0 fd0 deleted the fix-2249 branch April 25, 2019 07:16
@cbane
Copy link

cbane commented Apr 29, 2019

The test for this fails if the system has SELinux enabled:

--- FAIL: TestMetadataChanged (0.01s)
    testing.go:30: using low-security KDF parameters for test                                                          
    config.go:65: disabling check of the chunker polynomial
    archiver_nowin_test.go:27: chdir to /tmp/restic-test-978949359                                                     
    archiver_nowin_test.go:53: metadata does not match:
        {*restic.Node}.ExtendedAttributes:
                -: []restic.ExtendedAttribute(nil)
                +: []restic.ExtendedAttribute{{Name: "security.selinux", Value: []uint8{0x75, 0x6e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x6e, 0x65, 0x64, 0x5f, 0x75, 0x3a, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x72, 0x3a, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x74, 0x6d, 0x70, 0x5f, 0x74, 0x3a, 0x73, 0x30, 0x00}}}
    asm_amd64.s:522: chdir back to /home/courtney/src/restic/internal/archiver
FAIL
FAIL    github.com/restic/restic/internal/archiver      4.323s

Having a default ACL on /tmp will also trigger the problem, with a system.posix_acl_access extended attribute. (You can use e.g. setfacl -d -m user:root:rwx /tmp to set one; and then setfacl -b /tmp to remove all ACLs.)

My idea for fixing this is to copy the security.selinux and system.posix_acl_access extended attributes from node2/node3 (if they exist) to want before checking if they match, but I haven't thought about this deeply.

@fd0
Copy link
Member Author

fd0 commented Apr 29, 2019

Oh, thanks for the hint. I'll fix the Windows tests first, then we'll see about these.

@fd0
Copy link
Member Author

fd0 commented May 6, 2019

FYI: I've fixed this (more or less accidentally) in #2266 by setting the field ExtendedAttributes to nil.

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

Successfully merging this pull request may close these issues.

Metadata-only changes are not recognized
3 participants