Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IPFS repo stat --human flag #6103

Closed
hareeshnagaraj opened this issue Mar 19, 2019 · 2 comments
Closed

IPFS repo stat --human flag #6103

hareeshnagaraj opened this issue Mar 19, 2019 · 2 comments
Labels
kind/bug A bug in existing code (including security flaws) topic/commands Topic commands

Comments

@hareeshnagaraj
Copy link

Version information:

go-ipfs version: 0.4.18-6f19dd5
Repo version: 7
System version: amd64/linux
Golang version: go1.11.1

Type: Bug

Description:

Querying the repo statistics using the "--human" flag, initially through the js-ipfs-api and later directly on the IPFS node revealed a curious behavior contradicting the official documentation.

Per docs:

USAGE
  ipfs repo stat - Get stats for the currently used repo.

SYNOPSIS
  ipfs repo stat [--human]

OPTIONS

  --human bool - Output RepoSize in MiB.

Actual result:
Only StorageMax is returned in MiB, NOT RepoSize on go-ipfs docker container

$ docker exec -it go-ipfs-node_1 ipfs repo stat --human
NumObjects:       63
RepoSize:         615942
StorageMax (MiB): 9536
RepoPath:         /data/ipfs
Version:          fs-repo@7

$ docker exec -it go-ipfs-node_1 ipfs repo stat
NumObjects: 63
RepoSize:   615942
StorageMax: 10000000000
RepoPath:   /data/ipfs
Version:    fs-repo@7
@Stebalien Stebalien added kind/bug A bug in existing code (including security flaws) topic/commands Topic commands labels Mar 20, 2019
@reinerRubin
Copy link
Contributor

Hello,
Checked the source code [1]. it seems that size is printed as is if it can not make MiB.
irb(main):004:0> 615942.0/(1024 *1024) => 0.5874080657958984
Would 0.587 make sense? eg:
RepoSize (MiB): 0.587

https://github.com/ipfs/go-ipfs/blob/e11bbd78203a59f673bb9c3b6ea81d9e25c8d52a/core/commands/repo.go#L189

@Stebalien
Copy link
Member

Fixed by @reinerRubin. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug A bug in existing code (including security flaws) topic/commands Topic commands
Projects
None yet
Development

No branches or pull requests

3 participants