Skip to content

Commit

Permalink
Merge pull request #3413 from ipfs/feat/fuse/osx-semver
Browse files Browse the repository at this point in the history
fuse: Parse OSX fuse version properly
  • Loading branch information
whyrusleeping committed Dec 6, 2016
2 parents c12f977 + 018a5d5 commit 6bcca84
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 4 deletions.
24 changes: 20 additions & 4 deletions fuse/node/mount_darwin.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import (
"syscall"

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

"gx/ipfs/QmU1N5xVAUXgo3XRTt6GhJ2SuJEbxj2zRgMS7FpjSR2U83/semver"
)

func init() {
Expand All @@ -29,7 +31,7 @@ var fuseVersionPkg = "github.com/jbenet/go-fuse-version/fuse-version"
var errStrFuseRequired = `OSXFUSE not found.
OSXFUSE is required to mount, please install it.
NOTE: Version 2.7.2 or higher required; prior versions are known to kernel panic!
NOTE: Version in between 2.7.2 and 3.0.0 is required; prior versions are known to kernel panic!
It is recommended you install it from the OSXFUSE website:
http://osxfuse.github.io/
Expand All @@ -54,6 +56,9 @@ It is recommended you install it from the OSXFUSE website:
For more help, see:
https://github.com/ipfs/go-ipfs/issues/177
OSXFUSE versions >3.0.0 are not compatible with version of FUSE library in current use.
This will be fixed in near future, see https://github.com/ipfs/go-ipfs/issues/3471
`

var errStrNeedFuseVersion = `unable to check fuse version.
Expand Down Expand Up @@ -138,11 +143,22 @@ func darwinFuseCheckVersion(node *core.IpfsNode) error {
}

log.Debug("mount: osxfuse version:", ov)
if strings.HasPrefix(ov, "2.7.") || strings.HasPrefix(ov, "2.8.") {
return nil

min := semver.MustParse("2.7.2")
max := semver.MustParse("3.0.0")
curr, err := semver.Make(ov)
if err != nil {
return err
}

return fmt.Errorf(errStrUpgradeFuse, ov)
if curr.LT(min) {
return fmt.Errorf(errStrUpgradeFuse, ov)
}
// TODO: Upgrade fuse lib and work nice with 3.0.0+
if curr.GE(max) {
return fmt.Errorf(errStrUpgradeFuse, ov)
}
return nil
}

func tryGFV() (string, error) {
Expand Down
6 changes: 6 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,12 @@
"hash": "QmXGevGDVTqeKdisBzaxEK4CJZqfxeXiVSWLaXaVWcG5on",
"name": "go-smux-multiplex",
"version": "1.1.4"
},
{
"author": "blang",
"hash": "QmU1N5xVAUXgo3XRTt6GhJ2SuJEbxj2zRgMS7FpjSR2U83",
"name": "semver",
"version": "3.3.0"
}
],
"gxVersion": "0.4.0",
Expand Down

0 comments on commit 6bcca84

Please sign in to comment.