ipfs / kubo

An IPFS implementation in Go
https://docs.ipfs.tech/how-to/command-line-quick-start/
Other
16.16k stars 3.01k forks source link

commands/cid: does not error if daemon is not active #10153

Open hacdias opened 1 year ago

hacdias commented 1 year ago

Checklist

Installation method

built from source

Version

Kubo version: 0.23.0-dev-9491cc973
Repo version: 15
System version: arm64/darwin
Golang version: go1.21.0

Config

N/A

Description

The ipfs cid format command does not show an error when a daemon is not active. For example, run:

ipfs cid format QmPr755CxWUwt39C2Yiw4UGKrv16uZhSgeZJmoHUUS9TSJ -v 2

If there's a daemon running, you get:

Error: invalid cid version: "2"

Otherwise, nothing. I also wonder if this happens with other commands. Wouldn't be surprised.

Jorropo commented 1 year ago

I don't think it's a bug. Theses commands do nothing, they read input and spit it out.

I don't see why they need to run on the daemon.


I missunderstood, yeah it should show an error message.

susarlanikhilesh commented 1 year ago

Should we just check nd.Daemon value in that command and return error ?

hacdias commented 1 year ago

@susarlanikhilesh no. This command should work with a non-active daemon. The problem here is that it the command is not outputting an error when an error happens and the daemon is not active. If the daemon is active, the error is returned (for example, when you give it an invalid CID). But if the daemon is not active, you do not get an error. You still get the correct output when everything goes well, but if anything's wrong, you don't get an error.