Skip to content

Commit

Permalink
OS interoperability (#2)
Browse files Browse the repository at this point in the history
Linux restricts naming of extended attributes to a fixed set of
namespace. Using `user.` as this is the most suitable one.
  • Loading branch information
Christian Häusler authored Feb 26, 2019
1 parent a37fc19 commit b1e72b7
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
12 changes: 8 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,17 @@ branches:
only:
- master

os:
- linux
- osx

env:
- GO111MODULE=on

before_script:
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
- chmod +x ./cc-test-reporter
- ./cc-test-reporter before-build
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter; fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then chmod +x ./cc-test-reporter; fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then ./cc-test-reporter before-build; fi

install:
- make deps
Expand All @@ -22,4 +26,4 @@ script:
- make test

after_script:
- ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT; fi
10 changes: 8 additions & 2 deletions tag/tag.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
)

// XattrName holds the extended attribute name the tags are stored with.
const XattrName = "bilocation.corvus-ch.name/v1/tags"
const XattrName = "user.bilocation.corvus-ch.name/v1/tags"

// Config provides the input for tag operations.
type Config interface {
Expand Down Expand Up @@ -76,7 +76,13 @@ func Write(file string, set Set) error {
}

func isAttributeNotFoundError(err error) bool {
return strings.Contains(err.Error(), "attribute not found")
for _, msg := range []string{"attribute not found", "no data available"} {
if strings.Contains(err.Error(), msg) {
return true
}
}

return false
}

func nameAndClassifier(s string) (string, string, bool) {
Expand Down
2 changes: 0 additions & 2 deletions tag/tag_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// +build integration

package tag_test

import (
Expand Down

0 comments on commit b1e72b7

Please sign in to comment.