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

blsync does not expand tilde for home #30304

Closed
lightclient opened this issue Aug 15, 2024 · 6 comments · Fixed by #30729
Closed

blsync does not expand tilde for home #30304

lightclient opened this issue Aug 15, 2024 · 6 comments · Fixed by #30729
Assignees
Labels

Comments

@lightclient
Copy link
Member

lightclient commented Aug 15, 2024

I think the following should work:

$ go run ./cmd/blsync --sepolia --beacon.api=https://xxx.io --beacon.checkpoint=$(curl -X 'GET' -H 'accept: application/json' 'https://xxx.io/eth/v1/beacon/headers/finalized' | jq -r ".data.root") --blsync.engine.api=http://localhost:8551 --blsync.jwtsecret=~/.ethereum/sepolia/geth/jwtsecret
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   667  100   667    0     0   1400      0 --:--:-- --:--:-- --:--:--  1398
Fatal: Error loading or generating JWT secret: open ~/.ethereum/sepolia/geth/jwtsecret: no such file or directory
exit status 1
@holiman
Copy link
Contributor

holiman commented Aug 15, 2024

tildes are expanded by your shell, nowhere else. So it's nothing geth does or doesn't do, your shell should have expanded it before it reached us. It's out of our hands.

@holiman
Copy link
Contributor

holiman commented Aug 15, 2024

See here:

[user@work go-ethereum]$ go run ./cmd/geth --config=~/.ethereum/sepolia/geth/jwtsecret
INFO [08-15|15:06:08.697] Starting Geth on Ethereum mainnet...
INFO [08-15|15:06:08.698] Bumping default cache on mainnet         provided=1024 updated=4096
Fatal: open ~/.ethereum/sepolia/geth/jwtsecret: no such file or directory
exit status 1
[user@work go-ethereum]$ go run ./cmd/geth --config ~/.ethereum/sepolia/geth/jwtsecret
INFO [08-15|15:06:15.676] Starting Geth on Ethereum mainnet...
INFO [08-15|15:06:15.677] Bumping default cache on mainnet         provided=1024 updated=4096
Fatal: read /home/user/.ethereum/sepolia/geth/jwtsecret: is a directory
exit status 1

If you use the =-sign, you leave it up to go. If you use a space instead, the shell expands it.

@lightclient
Copy link
Member Author

Right, but this also works:

$ go run ./cmd/geth attach --datadir=~/.ethereum/sepolia

So I feel like blsync isn't consistent?

@holiman
Copy link
Contributor

holiman commented Aug 20, 2024

Ah, you are right. So the datadir uses DirectoryFlag, https://github.com/ethereum/go-ethereum/blob/master/internal/flags/flags.go#L57

// DirectoryFlag is custom cli.Flag type which expand the received string to an absolute path.
// e.g. ~/.ethereum -> /home/username/.ethereum

So ok, I agree, let's change blsync.jwtsecret so that it also uses the same mechanism. I guess we need a new type, similar to DirectoryFlag, which is a FileFlag (maybe such a thing already exists)

@holiman
Copy link
Contributor

holiman commented Aug 20, 2024

There exists an cli.PathFlag out of the box, but it doesn't expand tildes.

@karalabe
Copy link
Member

karalabe commented Nov 5, 2024

FYI, cli v3 dropped the path flag.

holiman pushed a commit that referenced this issue Nov 6, 2024
closes #30304

We already use `DirectoryFlag` for `authrpc.jwtsecret` which expands the
tilde, so this should work out of the box
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