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

Fuse fixes #6135

Merged
merged 4 commits into from
Mar 28, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion core/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func Bootstrap(n *IpfsNode, cfg BootstrapConfig) (io.Closer, error) {
if len(cfg.BootstrapPeers()) == 0 {
// We *need* to bootstrap but we have no bootstrap peers
// configured *at all*, inform the user.
log.Error("no bootstrap nodes configured: go-ipfs may have difficulty connecting to the network")
log.Warning("no bootstrap nodes configured: go-ipfs may have difficulty connecting to the network")
}

// the periodic bootstrap function -- the connection supervisor
Expand Down
8 changes: 7 additions & 1 deletion fuse/ipns/ipns_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import (
"sync"
"testing"

"bazil.org/fuse"

core "github.com/ipfs/go-ipfs/core"

fstest "bazil.org/fuse/fs/fstestutil"
Expand Down Expand Up @@ -106,6 +108,7 @@ func (m *mountWrap) Close() error {
}

func setupIpnsTest(t *testing.T, node *core.IpfsNode) (*core.IpfsNode, *mountWrap) {
t.Helper()
maybeSkipFuseTests(t)

var err error
Expand All @@ -126,8 +129,11 @@ func setupIpnsTest(t *testing.T, node *core.IpfsNode) (*core.IpfsNode, *mountWra
t.Fatal(err)
}
mnt, err := fstest.MountedT(t, fs, nil)
if err == fuse.ErrOSXFUSENotFound {
t.Skip(err)
}
if err != nil {
t.Fatal(err)
t.Fatalf("error mounting at temporary directory: %v", err)
}

return node, &mountWrap{
Expand Down
20 changes: 13 additions & 7 deletions fuse/node/mount_darwin.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ func init() {

// dontCheckOSXFUSEConfigKey is a key used to let the user tell us to
// skip fuse checks.
var dontCheckOSXFUSEConfigKey = "DontCheckOSXFUSE"
const dontCheckOSXFUSEConfigKey = "DontCheckOSXFUSE"

// fuseVersionPkg is the go pkg url for fuse-version
var fuseVersionPkg = "github.com/jbenet/go-fuse-version/fuse-version"
const fuseVersionPkg = "github.com/jbenet/go-fuse-version/fuse-version"

// errStrFuseRequired is returned when we're sure the user does not have fuse.
var errStrFuseRequired = `OSXFUSE not found.
Expand Down Expand Up @@ -58,7 +58,12 @@ For more help, see:
https://github.com/ipfs/go-ipfs/issues/177
`

var errStrNeedFuseVersion = `unable to check fuse version.
type errNeedFuseVersion struct {
cause string
}

func (me errNeedFuseVersion) Error() string {
return fmt.Sprintf(`unable to check fuse version.

Dear User,

Expand All @@ -79,7 +84,8 @@ version you have by running:
[1]: https://github.com/ipfs/go-ipfs/issues/177
[2]: https://github.com/ipfs/go-ipfs/pull/533
[3]: %s
`
`, fuseVersionPkg, dontCheckOSXFUSEConfigKey, me.cause)
}

var errStrFailedToRunFuseVersion = `unable to check fuse version.

Expand Down Expand Up @@ -197,7 +203,7 @@ func ensureFuseVersionIsInstalled() error {

// try installing it...
log.Debug("fuse-version: no fuse-version. attempting to install.")
cmd := exec.Command("go", "get", "github.com/jbenet/go-fuse-version/fuse-version")
cmd := exec.Command("go", "install", "github.com/jbenet/go-fuse-version/fuse-version")
cmdout := new(bytes.Buffer)
cmd.Stdout = cmdout
cmd.Stderr = cmdout
Expand All @@ -211,13 +217,13 @@ func ensureFuseVersionIsInstalled() error {

log.Debug("fuse-version: failed to install.")
s := err.Error() + "\n" + cmdoutstr
return fmt.Errorf(errStrNeedFuseVersion, fuseVersionPkg, dontCheckOSXFUSEConfigKey, s)
return errNeedFuseVersion{s}
}

// ok, try again...
if _, err := exec.LookPath("fuse-version"); err != nil {
log.Debug("fuse-version: failed to install?")
return fmt.Errorf(errStrNeedFuseVersion, fuseVersionPkg, dontCheckOSXFUSEConfigKey, err)
return errNeedFuseVersion{err.Error()}
}

log.Debug("fuse-version: install success")
Expand Down
7 changes: 6 additions & 1 deletion fuse/node/mount_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import (
"testing"
"time"

"bazil.org/fuse"

"context"

core "github.com/ipfs/go-ipfs/core"
Expand Down Expand Up @@ -61,8 +63,11 @@ func TestExternalUnmount(t *testing.T) {
mkdir(t, ipnsDir)

err = Mount(node, ipfsDir, ipnsDir)
if _, ok := err.(errNeedFuseVersion); ok || err == fuse.ErrOSXFUSENotFound {
t.Skip(err)
}
if err != nil {
t.Fatal(err)
t.Fatalf("error mounting: %v", err)
}

// Run shell command to externally unmount the directory
Expand Down
8 changes: 7 additions & 1 deletion fuse/readonly/ipfs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import (
"sync"
"testing"

"bazil.org/fuse"

core "github.com/ipfs/go-ipfs/core"
coreapi "github.com/ipfs/go-ipfs/core/coreapi"
coremock "github.com/ipfs/go-ipfs/core/mock"
Expand Down Expand Up @@ -50,6 +52,7 @@ func randObj(t *testing.T, nd *core.IpfsNode, size int64) (ipld.Node, []byte) {
}

func setupIpfsTest(t *testing.T, node *core.IpfsNode) (*core.IpfsNode, *fstest.Mount) {
t.Helper()
maybeSkipFuseTests(t)

var err error
Expand All @@ -62,8 +65,11 @@ func setupIpfsTest(t *testing.T, node *core.IpfsNode) (*core.IpfsNode, *fstest.M

fs := NewFileSystem(node)
mnt, err := fstest.MountedT(t, fs, nil)
if err == fuse.ErrOSXFUSENotFound {
t.Skip(err)
}
if err != nil {
t.Fatal(err)
t.Fatalf("error mounting temporary directory: %v", err)
}

return node, mnt
Expand Down