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

[#issue 3127] Add xattr support for Solaris #3628

Merged
merged 1 commit into from Feb 17, 2022

Conversation

gautammenghani
Copy link
Contributor

@gautammenghani gautammenghani commented Jan 10, 2022

What does this PR change? What problem does it solve?

Fixes #3127

Added build tag for solaris and removed redundant functions in node_solaris.go. Also added example command in documentation.

Was the change previously discussed in an issue or on the forum?

Checklist

  • I have read the contribution guidelines.
  • I have enabled maintainer edits.
  • I have added tests for all code changes.
  • I have added documentation for relevant changes (in the manual).
  • There's a new file in changelog/unreleased/ that describes the changes for our users (see template).
  • 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.

@MichaelEischer
Copy link
Member

The change itself looks fine. Please add a short changelog entry.

Are you using Solaris and can test the PR? Or can someone else help with that?

@gautammenghani
Copy link
Contributor Author

I've added the changelog. I do not have Solaris to test this. It would be great if somebody having solaris can test this.

@gco
Copy link
Contributor

gco commented Jan 14, 2022

Same results as last time I tried this, the xattr internals does something nasty with file descriptors. This is on Solaris(tm).

A short excerpt from a very long log filled with similar errors:

build: running tests
build: environment (GO*):
build:   GOARCH=amd64
build:   GOARM=
build:   GO111MODULE=on
build:   GOOS=solaris
build: chdir "/pool/projects/restic"
build: go ["test" "-count" "1" "./..."]
?       github.com/restic/restic        [no test files]
could not read signature from exclusion tagfile "/tmp/restic-test-1687343194/CACHEDIR.TAG": unexpected EOF
integration_test.go:88: Error while backing up

helpers.go:192: unexpected error: unlinkat /tmp/restic-test-2481435712: bad file number

--- FAIL: TestBackup (0.31s)
    testing.go:30: using low-security KDF parameters for test
    config.go:65: disabling check of the chunker polynomial
    testing.go:30: using low-security KDF parameters for test
    config.go:65: disabling check of the chunker polynomial
    lock.go:82: setting lock timeout to 0s
    integration_test.go:56: repository initialized at /tmp/restic-test-2481435712/repo
    integration_test.go:68: backing up [testdata] in /tmp/restic-test-2481435712
    integration_test.go:70: chdir to /tmp/restic-test-2481435712
    integration_test.go:83: chdir back to /pool/projects/restic/cmd/restic
integration_test.go:88: Error while backing up

--- FAIL: TestDryRunBackup (0.04s)
...
...
    integration_test.go:68: backing up [/tmp/restic-test-187746066/testdata/0/0/9] in
integration_test.go:88: Error while backing up

helpers.go:192: unexpected error: unlinkat /tmp/restic-test-1747024417: bad file number

--- FAIL: TestCopyIncremental (0.06s)
...
...

@MichaelEischer
Copy link
Member

Thanks for testing. However, this means that this PR is stuck indefinitely until someone using Solaris can investigate what's going on.

@gco
Copy link
Contributor

gco commented Jan 25, 2022

I'm new to go, but I suspect that the xattr implementation for Solaris is causing file descriptors to be closed twice. Any fd passed to os.NewFile should be closed when the File is gc'd:

Otherwise, during garbage collection the finalizer may close an unrelated file descriptor with the same (reused) number.

With these changes and some cleanup of the restic tests for Solaris quirks, all tests pass and I didn't see any signs of fd leaks examining the truss output.

@gco gco mentioned this pull request Feb 2, 2022
8 tasks
@gco
Copy link
Contributor

gco commented Feb 2, 2022

PR pkg/xattr#62 was accepted and is fixed.

@gautammenghani
Copy link
Contributor Author

Thanks! I've rebased the code

@MichaelEischer
Copy link
Member

@gum3ng Please update the xattr library to include the xattr fix: go get github.com/pkg/xattr

@gautammenghani
Copy link
Contributor Author

I've updated the xattr version. Please let me know if anymore changes are required.

@MichaelEischer
Copy link
Member

@gco Can you test whether xattr support works on Solaris when applying this PR?

@gco
Copy link
Contributor

gco commented Feb 17, 2022

@gco Can you test whether xattr support works on Solaris when applying this PR?

@MichaelEischer go run build.go --test --verbose passes on Solaris 11.4.

Copy link
Member

@MichaelEischer MichaelEischer left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks for changes. @gco thank you for testing!

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.

Add xattr support for Solaris/SmartOS
3 participants