eth-educators/eth-docker

Error: stat: illegal option -- -

toraonion opened this issue · 9 comments

I used Docker Desktop on MacOS.

Upon running ./ethd config has this error

stat: illegal option -- -
usage: stat [-FlLnqrsx] [-f format] [-t timefmt] [file ...]

A few days back, I can run the script ok. Today is the time I met this error.

Fun. This was changed because another macOS user complained of it. Which version of macOS is this?

@alindsilva , can you comment on this? On your machine, the original stat failed, and you suggested changing it to stat --format=%U .. On toraonion's machine, that fails. Let's find a format that works across the board.

For reference, this used to be stat -f '$Su' . on macOS

@toraonion , can you try stat -c %U . and see how it behaves?

I deployed on my old mini Catalina 10.15.7

Fast check and still the same
stat: illegal option -- c
usage: stat [-FlLnqrsx] [-f format] [-t timefmt] [file ...]

Ok so that ones uses -f. Which is why that was there. @alindsilva, on your machine, why was that an issue, and what version of macOS is that?

I reverted that change @toraonion . While this fixes it for you, I need to hear from alindsilva on what's different for their version of stat on OSX. Different shell maybe?

You could help me find a more portable option by trying ls -ld . | awk '{print $3}' . If that prints the owner, then maybe I stop using stat entirely

Yorick - I am on an iMAC Intel running Venture 13.6.4

$ bash --version
GNU bash, version 5.2.26(1)-release (x86_64-apple-darwin22.6.0)

Trying the new ls based command I get the right user like stat
$ ls -ld . | awk '{print $3}'
alin

btw - the updated stat command I provided to you earlier does not work properly on my Macbook Pro Apple Silicon running Bash 5 and MAC OS Sonoma 14.3.1. On this Macbook Pro I had to change the stat to read ... stat -f '%Su' .

So I think it will be best for you to switch this out to the ls option.

I spent most of this weekend trying to get eth-docker running on my Macbook Pro. If I have a few simple question for you, is it best for me to post them in the ethstaker discord? Or can I send you a DM there?

Ethstaker discord is best, and let's use the #software channel, not DMs.

Ok let me change to the ls command, it should be portable across most UNIX-like operating systems, as it just relies on the "permissions links owner" format, which seems universal for ls -l

Change made and I'll assume that fixes it. Will leave this open for a bit just in case there are more issues on macOS

Closing