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

fix(shell): install-gcloud fails on macOS 12.2.1 #17

Open
1 task done
patrickserrano opened this issue Feb 16, 2022 · 2 comments · May be fixed by #19
Open
1 task done

fix(shell): install-gcloud fails on macOS 12.2.1 #17

patrickserrano opened this issue Feb 16, 2022 · 2 comments · May be fixed by #19
Labels
bug Something isn't working needs triage Issue needs to be reviewed

Comments

@patrickserrano
Copy link

patrickserrano commented Feb 16, 2022

Commands to Reproduce

install-gcloud

Expected Results

Google Cloud SDK to be installed

Actual Results

rm returns an illegal option error.

rm on macOS doesn't support `--recursive` and `--force` instead opting for `-r` and `-f` respectively. I'm guessing it has something to do with this from the man page:

NOTE
     The rm command uses getopt(3) to parse its arguments, which allows it to accept the ‘--’ option which
     will cause it to stop processing flag options at that point.  This will allow the removal of file names
     that begin with a dash (‘-’).  For example:
           rm -- -filename
     The same behavior can be obtained by using an absolute or relative path reference.  For example:
           rm /home/user/-filename
           rm ./-filename

Any additional logs that will help us?

install-gcloud: installing gcloud-sdk...
download-safe: attempting to download: https://dl.google.com/dl/cloudsdk/channels/rapid/google-cloud-sdk.tar.gz
rm: illegal option -- -
usage: rm [-f | -i] [-dPRrvW] file ...
       unlink file

Operating System(s)

macOS

Operating System (Other)

No response

Architecture

arm64 / aarch64

Shell

zsh

Terminal Program(s)

other

Terminal Program(s) (Other)

iTerm2

What is the output from uname -srv on the system(s) where the bug is occurring?

Darwin 21.3.0 Darwin Kernel Version 21.3.0: Wed Jan 5 21:37:58 PST 2022; root:xnu-8019.80.24~20/RELEASE_ARM64_T6000

Code of Conduct

  • I agree to follow this project's code of conduct
@patrickserrano patrickserrano added bug Something isn't working needs triage Issue needs to be reviewed labels Feb 16, 2022
@patrickserrano
Copy link
Author

@dmccaffery this issue also impacts install-dotnet (and probably install-aws) when run with -f or --force since it uses the long form rm --recursive --force instead of rm -rf.

-> install-dotnet -f
rm: illegal option -- -
usage: rm [-f | -i] [-dPRrvW] file ...
       unlink file

Also, I noticed that install-gcloud when run with -f or --force uses rm -rf instead of rm --recursive --force. I can open a PR with a fix for all three scripts so we're using rm -rf everywhere if that's how you want to proceed.

@sjk07
Copy link
Member

sjk07 commented Sep 16, 2022

@patrickserrano I would like to follow the below statement on our readme...

NOTE: We believe in transparency and clarity of commands, hence the expanded form for the options above. The -s flag for the shell command means "read commands from standard input". For more information, see the POSIX Specification.

I understand that it seems macOS cannot support the fully qualified flags. in such a case it may be necessary to create a wrapper around the rm command or a separate script for macOS. This in the long term will require more maintenance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs triage Issue needs to be reviewed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants