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

attach --exec opens up the interactive console and does not log the result #25224

Closed
SomeGuyCalledBru opened this issue Jul 1, 2022 · 2 comments · Fixed by #25234
Closed
Assignees
Labels

Comments

@SomeGuyCalledBru
Copy link

SomeGuyCalledBru commented Jul 1, 2022

System information

Geth version: Geth Version: 1.10.20-stable Architecture: amd64 Go Version: go1.18.3 Operating System: linux GOPATH= GOROOT=go
OS & Version: Ubuntu 20.04 LTS
Commit hash : -

Latest geth seems to have broken attach behavior - the --exec flag does nothing.

Expected behaviour

--exec prints out result and quits

Actual behaviour

--exec prints out nothing and opens up the interactive console.

Steps to reproduce the behaviour

Run any command with attach using --exec on v1.10.20

Backtrace

root@Ubuntu-2004-user ~/eth-node # ./geth_ethereum attach /root/eth-node/datadir/geth.ipc --exec "admin.nodeInfo"
Welcome to the Geth JavaScript console!

instance: Geth/v1.10.20-stable/linux-amd64/go1.18.3
at block: 15057827 (Fri Jul 01 2022 19:05:44 GMT+0200 (CEST))
datadir: /root/eth-node/datadir
modules: admin:1.0 debug:1.0 eth:1.0 ethash:1.0 miner:1.0 net:1.0 personal:1.0 rpc:1.0 txpool:1.0 web3:1.0

To exit, press ctrl-d or type exit
>

image
Also seems to be reproduced by discord user schone#2266.

@SomeGuyCalledBru SomeGuyCalledBru changed the title attach --exec opens up the interactive console and does not log the result attach --exec opens up the interactive console and does not log the result Jul 1, 2022
@fjl fjl self-assigned this Jul 1, 2022
@fjl
Copy link
Contributor

fjl commented Jul 1, 2022

This is a consequence of our cli library upgrade. In your command-line invocation, the flag --exec comes after the argument /root/eth-node/datadir/geth.ipc. With geth v1.10.20, this is no longer allowed by the cli parser, and you need to give the flag before the argument instead:

./geth_ethereum attach --exec "admin.nodeInfo" /root/eth-node/datadir/geth.ipc

I added an error in other commands like account import for this case, but didn't add it in attach.

@fjl
Copy link
Contributor

fjl commented Jul 4, 2022

geth attach will now exit with error if flags are given after the argument.

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.

3 participants
@fjl @SomeGuyCalledBru and others