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

[Bug]: prevalent stdout/stderr stream confusion #19368

Closed
1 task done
michaelfig opened this issue Feb 7, 2024 · 0 comments · Fixed by #19371
Closed
1 task done

[Bug]: prevalent stdout/stderr stream confusion #19368

michaelfig opened this issue Feb 7, 2024 · 0 comments · Fixed by #19371
Labels

Comments

@michaelfig
Copy link
Contributor

Is there an existing issue for this?

  • I have searched the existing issues

What happened?

When using output from appd keys show -a MYKEY --keyring-backend=test in a script, I had flaky results. After spending considerable time narrowing it down, the problem was sometimes the output would be:

agoric1abcdefghi12345

and sometimes it was:

Successfully migrated key MYKEY.
agoric1abcdefghi12345

CLIs that are designed to produce machine-readable output should not frustrate attempts to consume stdout with corner-cases that interrupt the standard behaviour. This goes much further than just the "Sucessfully migrated key..." message in cosmos-sdk/crypto/keyring/keyring.go. I would expect a careful audit of all uses of fmt.Print* in the SDK, and where the output is not usefully capturable by a calling program, it should be directed at stderr instead.

I recognise that the converse also needs to be true: if writes to os.Stderr are usefully capturable by a calling program, they should be directed at stdout.

Cosmos SDK Version

main

How to reproduce?

Search the SDK for fmt\.Print, and observe its use within libraries such as crypto.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant