From d42242556b964d3423cbfccc5b0264506bfff127 Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Thu, 14 May 2015 23:13:00 +0200 Subject: [PATCH 1/2] Fix restic for i386 Some functions aren't implemented on Linux/i386, e.g. user.LookupId() and user.Current(), so ignore these errors. --- node.go | 10 ++++++---- snapshot.go | 4 ++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/node.go b/node.go index 13d44ca04..2071c7acf 100644 --- a/node.go +++ b/node.go @@ -389,16 +389,18 @@ func lookupUsername(uid string) (string, error) { return value, nil } + username := "" + u, err := user.LookupId(uid) - if err != nil { - return "", err + if err == nil { + username = u.Username } uidLookupCacheMutex.Lock() - uidLookupCache[uid] = u.Username + uidLookupCache[uid] = username uidLookupCacheMutex.Unlock() - return u.Username, nil + return username, nil } func (node *Node) fillExtra(path string, fi os.FileInfo) error { diff --git a/snapshot.go b/snapshot.go index 7558f15c3..c5abca5e1 100644 --- a/snapshot.go +++ b/snapshot.go @@ -71,10 +71,10 @@ func (sn Snapshot) ID() backend.ID { func (sn *Snapshot) fillUserInfo() error { usr, err := user.Current() if err != nil { - return err + return nil } - sn.Username = usr.Username + uid, err := strconv.ParseInt(usr.Uid, 10, 32) if err != nil { return err From eee93e91251416cf8be9641a48bdb10da5423a5c Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Thu, 14 May 2015 23:20:12 +0200 Subject: [PATCH 2/2] travis: Run tests for 386 and amd64 --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 672e08ec1..54bd6d0cc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -31,7 +31,9 @@ script: - make restic - make gox - make test + - GOARCH=386 make test - make test-integration + - GOARCH=386 make test-integration - make all.cov - goveralls -coverprofile=all.cov -service=travis-ci -repotoken "$COVERALLS_TOKEN" - gofmt -l *.go */*.go */*/*.go