lighthouse icon indicating copy to clipboard operation
lighthouse copied to clipboard

feat(scripts): fix bug about `sed -i`

Open mask-pp opened this issue 1 year ago • 15 comments

Issue Addressed

Which issue # does this PR address? appear error when run ./setup_time.sh genesis.json:

  • grep: invalid option -- P
  • sed: 1: "genesis.json": extra characters at the end of g command
  • typo: taif in scripts/local_testnet/README.md
  • The lost of --debug-level flag in bootnode.sh
  • Avoid using GNU sed/grep in macOS system.

Proposed Changes

Please list or describe the changes introduced by this PR.

Additional Info

Please provide any additional information. For example, future considerations or information useful for reviewers.

mask-pp avatar Feb 01 '24 13:02 mask-pp

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Feb 01 '24 13:02 CLAassistant

which OS are you using where it didn't work? AFAIK our scripts are working on Linux and macOS. Are you using a BSD?

michaelsproul avatar Feb 01 '24 21:02 michaelsproul

which OS are you using where it didn't work? AFAIK our scripts are working on Linux and macOS. Are you using a BSD?

My OS is macOS m3.

mask-pp avatar Feb 02 '24 07:02 mask-pp

which OS are you using where it didn't work? AFAIK our scripts are working on Linux and macOS. Are you using a BSD?

On mac you need to install gnu sed and gnu grep to run these scripts. If these changes work for linux an mac out of the box, it'd be nice.

realbigsean avatar Apr 04 '24 15:04 realbigsean

@mask-pp would you mind signing the CLA?

realbigsean avatar Apr 04 '24 15:04 realbigsean

@mask-pp would you mind signing the CLA?

Done!

mask-pp avatar Apr 23 '24 14:04 mask-pp

Thanks for the PR, left some comments

Thanks very much for your review man.

mask-pp avatar Apr 23 '24 14:04 mask-pp

Thanks for the PR, left some comments

Thanks very much for your review man.

I am good with the proposed change since it does the same thing, and it will be good for other users using MacOS trying to run a local testnet using the scripts. So I am happy to recommend merging this PR.

Thanks again!

Edit: how about the change in bootnode logs from to setup.sh: https://github.com/sigp/lighthouse/pull/5169#discussion_r1576198261

It is not a major thing, but may I know the motivation behind? I think that should work on MacOS? If so, we can remain that part the same

chong-he avatar Apr 24 '24 02:04 chong-he

Thanks for the PR, left some comments

Thanks very much for your review man.

I am good with the proposed change since it does the same thing, and it will be good for other users using MacOS trying to run a local testnet using the scripts. So I am happy to recommend merging this PR.

Thanks again!

Edit: how about the change in bootnode logs from to setup.sh: #5169 (comment)

It is not a major thing, but may I know the motivation behind? I think that should work on MacOS? If so, we can remain that part the same

Yeah, the bootnode change is optional. It is correct to write the bootnode log into bootnode.log. In order to reduce unnecessary changes I have reverted it.

mask-pp avatar Apr 24 '24 03:04 mask-pp

Thanks @mask-pp

This seems to be a cleaner solution to enable MacOS to work with the script with sed -i: https://www.reddit.com/r/linux4noobs/comments/ne0ti8/why_does_sed_i_not_work_on_my_mac/

Could you give this a try and see if it works? If so, I can test linux on my end and we can use this cleaner solution

chong-he avatar Apr 24 '24 23:04 chong-he

Thanks @mask-pp

This seems to be a cleaner solution to enable MacOS to work with the script with sed -i: https://www.reddit.com/r/linux4noobs/comments/ne0ti8/why_does_sed_i_not_work_on_my_mac/

Could you give this a try and see if it works? If so, I can test linux on my end and we can use this cleaner solution

It works with sed -i '' in macOS, but it doesn't work in linux. The best way I can imagine to be compatible with mac and linux is don't use the parameter "-i".

mask-pp avatar Apr 25 '24 02:04 mask-pp

Thanks for this PR!

I also noticed that we need to remove these lines from local-testnet.yml to avoid using GNU sed/grep in CI for macOS:

https://github.com/sigp/lighthouse/blob/8cd2b1ca87a7bf660130279558ed5dd9e91dda75/.github/workflows/local-testnet.yml#L42-L47

and the README in the local_testnet directory:

https://github.com/sigp/lighthouse/blob/003bb0ae3cc41e082c1e5462cfcd9341a4785bfc/scripts/local_testnet/README.md#L11

Deleted.

mask-pp avatar Apr 26 '24 01:04 mask-pp

I am not sure why we need to delete the line on the README.md file? @ackintosh

As for the local-testnet.yml, does #5643 fix it?

chong-he avatar Apr 29 '24 12:04 chong-he

I am not sure why we need to delete the line on the README.md file? @ackintosh

If my understanding of this PR is correct, it eliminates the need for macOS users to install GNU sed/grep. They can now run start_local_testnet.sh using the built-in sed/grep commands. So the line in the README.md that encourages macOS users to install GNU sed/grep can be removed.

ackintosh avatar Apr 30 '24 01:04 ackintosh

Thanks @mask-pp, LGTM.

Could you please update the Proposed Changes section of this comment?

changed.

mask-pp avatar May 04 '24 01:05 mask-pp

Thank you so much for your contribution @mask-pp, but we recently replaced our local testnet scripts with kurtosis

  • https://github.com/sigp/lighthouse/pull/5865

dapplion avatar Jun 27 '24 15:06 dapplion