@cryptotaxi247 / kubo / commits / bc85a6384

fix fuse mount error in linux

There has been a regression such that ./t0030-mount.sh fails on 'ipfs mount' fails when there is no mount dir The issue was a change in how fuse errors are reported to the client process. We have introduced an optimistic categorization that hides the obscure fusermount error and replaces it with something a bit more helpful. License: MIT Signed-off-by: Juan Batiz-Benet <juan@benet.ai>

Juan Batiz-Benet committed Jun 18, 2015 at 01:45 UTC bc85a6384ba8602992af992514576e0c3108a734
1 file changed +10 -3
core/commands/mount_unix.go
+10 -3
@@ -24,6 +24,9 @@ const mountTimeout = time.Second
24 // fuseNoDirectory used to check the returning fuse error
25 const fuseNoDirectory = "fusermount: failed to access mountpoint"
26
27 +// fuseExitStatus1 used to check the returning fuse error
28 +const fuseExitStatus1 = "fusermount: exit status 1"
29 +
30 // platformFuseChecks can get overridden by arch-specific files
31 // to run fuse checks (like checking the OSXFUSE version)
32 var platformFuseChecks = func(*core.IpfsNode) error {
@@ -181,13 +184,17 @@ func Mount(node *core.IpfsNode, fsdir, nsdir string) error {
184 }
185
186 func doMount(node *core.IpfsNode, fsdir, nsdir string) error {
184 - fmtFuseErr := func(err error) error {
187 + fmtFuseErr := func(err error, mountpoint string) error {
188 s := err.Error()
189 if strings.Contains(s, fuseNoDirectory) {
190 s = strings.Replace(s, `fusermount: "fusermount:`, "", -1)
191 s = strings.Replace(s, `\n", exit status 1`, "", -1)
192 return cmds.ClientError(s)
193 }
194 + if s == fuseExitStatus1 {
195 + s = fmt.Sprintf("fuse failed to access mountpoint %s", mountpoint)
196 + return cmds.ClientError(s)
197 + }
198 return err
199 }
200
@@ -222,9 +229,9 @@ func doMount(node *core.IpfsNode, fsdir, nsdir string) error {
229 }
230
231 if err1 != nil {
225 - return fmtFuseErr(err1)
232 + return fmtFuseErr(err1, fsdir)
233 }
227 - return fmtFuseErr(err2)
234 + return fmtFuseErr(err2, nsdir)
235 }
236
237 // setup node state, so that it can be cancelled