Skip to content

Strange error trying to run the daemon through supervisord #861

Closed
@darkstar

Description

@darkstar

When I try to run the daemon through supervisord, I keep getting the following error in the log file (stdout/stderr):

Use 'ipfs daemon --help' for information about this command
Error: Expected 0 arguments, got 1

which is strange as the config file I'm using to launch the daemon contains just the word "daemon" as argument:

[program:ipfs]
command=/var/lib/go/bin/ipfs daemon
user=darkstar
redirect_stderr=true
stdout_logfile=/var/log/ipfs-daemon.log

I tried tracing the launch with strace and it also shows that only 1 argument is given:

darkstar@flonne:/etc/supervisor$ cat /tmp/strace.log |grep daemon
open("/var/log/ipfs-daemon.log", O_WRONLY|O_CREAT|O_APPEND|O_LARGEFILE, 0666) = 9
[pid  9015] execve("/var/lib/go/bin/ipfs", ["/var/lib/go/bin/ipfs", "daemon"], [/* 28 vars */]) = 0
[pid  9015] write(2, "Use 'ipfs daemon --help' for inf"..., 60 <unfinished ...>
[pid  9012] read(7, "Use 'ipfs daemon --help' for inf"..., 131072) = 60
[pid  9012] write(9, "Use 'ipfs daemon --help' for inf"..., 60) = 60

Then I modified the file github.com/jbenet/go-ipfs/commands/cli/parse.go to print the arguments:

darkstar@flonne:/var/lib/go/src/github.com/jbenet/go-ipfs$ git diff commands/cli/parse.go
diff --git a/commands/cli/parse.go b/commands/cli/parse.go
index 4981747..7590174 100644
--- a/commands/cli/parse.go
+++ b/commands/cli/parse.go
@@ -171,7 +171,7 @@ func parseArgs(inputs []string, stdin *os.File, argDefs []cmds.Argument, recursi
        // and the last arg definition is not variadic (or there are no definitions), return an error
        notVariadic := len(argDefs) == 0 || !argDefs[len(argDefs)-1].Variadic
        if notVariadic && numInputs > len(argDefs) {
-               return nil, nil, fmt.Errorf("Expected %v arguments, got %v", len(argDefs), numInputs)
+               return nil, nil, fmt.Errorf("Expected %v arguments, got %v: %v", len(argDefs), numInputs, inputs)
        }

        stringArgs := make([]string, 0, numInputs)

and recompiled via go get github.com/jbenet/go-ipfs/cmd/ipfs (note that I don't know any go language, so I don't know if there's a different/better way to just recompile that binary, but this seemed to work) and I got the following in the log file:

Use 'ipfs daemon --help' for information about this command
Error: Expected 0 arguments, got 1: []

At this point I'm out of ideas what goes wrong where. I know that supervisord launches the binary correctly (as shown by the strace output), however, ipfs seems to insist that there's an extra argument being given.

Any ideas?

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugA bug in existing code (including security flaws)topic/commandsTopic commands

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions