Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: ipfs/kubo
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 7a41dcb620f6^
Choose a base ref
...
head repository: ipfs/kubo
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: a8dae30db175
Choose a head ref
  • 3 commits
  • 10 files changed
  • 1 contributor

Commits on Jul 29, 2015

  1. updated goprocess (SetTeardown fix)

    License: MIT
    Signed-off-by: Juan Batiz-Benet <juan@benet.ai>
    jbenet committed Jul 29, 2015
    Copy the full SHA
    7a41dcb View commit details
  2. fuse unmount fixes

    unmounting wasn't happening, mostly because of a recent bug in
    goprocess.SetTeardown. This commit bumps up some messages to
    log.Warnings, as users may want to see them, and makes sure to
    Unmount when a node shuts down.
    
    License: MIT
    Signed-off-by: Juan Batiz-Benet <juan@benet.ai>
    jbenet committed Jul 29, 2015

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    578fd02 View commit details
  3. add -w: fix to work correctly with dirs.

    this commit changes the behavior of ipfs add -w:
    
    - it makes it able to work with ipfs add -r <dir>
    - instead of hacking around the add, we simply just add a wrapper
      directory around the whole result of the add. this means that
      ipfs add -w calls will output _two_ lines, but this is actually
      more correct than outputting one line, as two objects were added.
      this _may_ break scripts out there which expect the output to
      look a certain way. we should consider whether the old output is
      more _useful_ (even if less in-line with the model.)
    
    License: MIT
    Signed-off-by: Juan Batiz-Benet <juan@benet.ai>
    jbenet committed Jul 29, 2015
    Copy the full SHA
    a8dae30 View commit details
2 changes: 1 addition & 1 deletion Godeps/Godeps.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 14 additions & 14 deletions Godeps/_workspace/src/github.com/jbenet/goprocess/impl-mutex.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 5 additions & 15 deletions core/commands/add.go
Original file line number Diff line number Diff line change
@@ -10,7 +10,6 @@ import (
cmds "github.com/ipfs/go-ipfs/commands"
files "github.com/ipfs/go-ipfs/commands/files"
core "github.com/ipfs/go-ipfs/core"
coreunix "github.com/ipfs/go-ipfs/core/coreunix"
importer "github.com/ipfs/go-ipfs/importer"
"github.com/ipfs/go-ipfs/importer/chunk"
dag "github.com/ipfs/go-ipfs/merkledag"
@@ -128,10 +127,14 @@ remains to be implemented.
node: n,
out: outChan,
progress: progress,
wrap: wrap,
hidden: hidden,
trickle: trickle,
}

if wrap {
file = files.NewSliceFile("", []files.File{file})
}

rootnd, err := addParams.addFile(file)
if err != nil {
res.SetError(err, cmds.ErrNormal)
@@ -247,7 +250,6 @@ type adder struct {
node *core.IpfsNode
out chan interface{}
progress bool
wrap bool
hidden bool
trickle bool
}
@@ -299,18 +301,6 @@ func (params *adder) addFile(file files.File) (*dag.Node, error) {
reader = &progressReader{file: file, out: params.out}
}

if params.wrap {
p, dagnode, err := coreunix.AddWrapped(params.node, reader, path.Base(file.FileName()))
if err != nil {
return nil, err
}
params.out <- &AddedObject{
Hash: p,
Name: file.FileName(),
}
return dagnode, nil
}

dagnode, err := add(params.node, reader, params.trickle)
if err != nil {
return nil, err
2 changes: 1 addition & 1 deletion core/commands/mount_unix.go
Original file line number Diff line number Diff line change
@@ -216,7 +216,7 @@ func doMount(node *core.IpfsNode, fsdir, nsdir string) error {
<-done

if err1 != nil || err2 != nil {
log.Infof("error mounting: %s %s", err1, err2)
log.Errorf("error mounting: %s %s", err1, err2)
if fsmount != nil {
fsmount.Unmount()
}
7 changes: 7 additions & 0 deletions core/core.go
Original file line number Diff line number Diff line change
@@ -382,6 +382,13 @@ func (n *IpfsNode) teardown() error {
n.Repo,
}

if n.Mounts.Ipfs != nil {
closers = append(closers, mount.Closer(n.Mounts.Ipfs))
}
if n.Mounts.Ipns != nil {
closers = append(closers, mount.Closer(n.Mounts.Ipns))
}

// Filesystem needs to be closed before network, dht, and blockservice
// so it can use them as its shutting down
if n.IpnsFs != nil {
4 changes: 2 additions & 2 deletions fuse/mount/fuse.go
Original file line number Diff line number Diff line change
@@ -96,15 +96,15 @@ func (m *mount) unmount() error {
if err == nil {
return nil
}
log.Debug("fuse unmount err: %s", err)
log.Warningf("fuse unmount err: %s", err)

// try closing the fuseConn
err = m.fuseConn.Close()
if err == nil {
return nil
}
if err != nil {
log.Debug("fuse conn error: %s", err)
log.Warningf("fuse conn error: %s", err)
}

// try mount.ForceUnmountManyTimes
18 changes: 16 additions & 2 deletions fuse/mount/mount.go
Original file line number Diff line number Diff line change
@@ -3,6 +3,7 @@ package mount

import (
"fmt"
"io"
"os/exec"
"runtime"
"time"
@@ -33,7 +34,7 @@ type Mount interface {
// It does so by calling diskutil or fusermount directly.
func ForceUnmount(m Mount) error {
point := m.MountPoint()
log.Infof("Force-Unmounting %s...", point)
log.Warningf("Force-Unmounting %s...", point)

var cmd *exec.Cmd
switch runtime.GOOS {
@@ -59,7 +60,7 @@ func ForceUnmount(m Mount) error {
}()

select {
case <-time.After(2 * time.Second):
case <-time.After(7 * time.Second):
return fmt.Errorf("umount timeout")
case err := <-errc:
return err
@@ -81,3 +82,16 @@ func ForceUnmountManyTimes(m Mount, attempts int) error {
}
return fmt.Errorf("Unmount %s failed after 10 seconds of trying.", m.MountPoint())
}

type closer struct {
M Mount
}

func (c *closer) Close() error {
log.Error(" (c *closer) Close(),", c.M.MountPoint())
return c.M.Unmount()
}

func Closer(m Mount) io.Closer {
return &closer{m}
}
16 changes: 14 additions & 2 deletions test/sharness/t0040-add-and-cat.sh
Original file line number Diff line number Diff line change
@@ -267,8 +267,20 @@ test_expect_success "ipfs add -w succeeds" '
'

test_expect_success "ipfs add -w output looks good" '
HASH="QmVJfrqd4ogGZME6LWkkikAGddYgh9dBs2U14DHZZUBk7W" &&
echo "added $HASH/hello.txt mountdir/hello.txt" >expected &&
HASH1="QmVr26fY1tKyspEJBniVhqxQeEjhF78XerGiqWAwraVLQH" &&
HASH2="QmVJfrqd4ogGZME6LWkkikAGddYgh9dBs2U14DHZZUBk7W" &&
echo "added $HASH1 mountdir/hello.txt" >expected &&
echo "added $HASH2 " >>expected &&
test_cmp expected actual
'

test_expect_success "ipfs add -w succeeds (dir)" '
ipfs add -r -w mountdir | tail -n1 >actual
'

test_expect_success "ipfs add -w output looks good (dir)" '
HASH="Qmc341yGztU1o8n3c1u5xTYF3uE3zPPP2NYemG9MKz775V" &&
echo "added $HASH " >expected &&
test_cmp expected actual
'