Closed lucaong closed 1 year ago
A couple of findings: as written above, the original issue is fixed by passing args[:script].dup
instead of args[:script]
to read_script_arguments
on https://github.com/Homebrew/brew/blob/98999cc51033c6f1b2aae662024cba8544dcd3fd/Library/Homebrew/cask/artifact/installer.rb#L85 . It looks like read_script_arguments
mutates the argument passed to it, removing the :executable
entry from the hash. Somehow the code path when installing google-cloud-sdk
calls read_script_arguments
twice, so the second time the :executable
property is missing.
Once that original problem is fixed though, the formula breaks with a different error:
Error: It seems the symlink source '/opt/homebrew/Caskroom/google-cloud-sdk/latest/$(brew --prefix)/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/completion.bash.inc' is not there.
The problem this time is in the formula: this line and this line should not prepend staged_path
to the source path. The source
method of Cask::Artifact::Relocated
already takes care of prepending the staged_path
here, so the resulting source ends up containing the staged_path
twice.
I am not sure why the issue popped up now with google-cloud-sdk
, and if the formula used to work before. Someone more familiar with the codebase should probably review my findings. If adding dup
and fixing the symlink paths in the formula are acceptable solutions, I am happy to send two PRs.
Interestingly, by only fixing the symlink sources in the formula, the original bug disappears. I created a pull request to fix the formula, that resolves this issue: https://github.com/Homebrew/homebrew-cask/pull/139749
I'm still seeing this.
I've run through
- [x] I understand that if I ignore these instructions, my issue may be closed without review.
- [x] I have retried my command with
--force
.- [x] I ran
brew update-reset && brew update
and retried my command.- [x] I ran
brew doctor
, fixed as many issues as possible and retried my command.- [x] I have checked the instructions for reporting bugs.
- [x] I made doubly sure this is not a checksum does not match error.
And I confirmed with brew edit google-cloud-sdk
that I have the change from #139749 locally. I still had to make this change
Passing
args[:script].dup
instead ofargs[:script]
toread_script_arguments
on https://github.com/Homebrew/brew/blob/98999cc51033c6f1b2aae662024cba8544dcd3fd/Library/Homebrew/cask/artifact/installer.rb#L85 fixes the error
to resolve. Several coworkers are reporting the same.
@miccal I see you've closed this issue - would you prefer we file a new one or reopen this one? I can provide further details in little bit, but my output from --verbose --debug
and brew doctor
is essentially the same as the original ticket.
Using .dup
or otherwise avoiding mutating args[:script]
in place is anyway a good idea in my opinion, to avoid these sort of bugs in case this code path is invoked twice. I am not sure if the update in place was done on purpose for performance reasons, but I would expect that the impact is negligible.
@miccal @aaronhipple I sent this pull request to address it.
Verification
--force
.brew update-reset && brew update
and retried my command.brew doctor
, fixed as many issues as possible and retried my command.Description of issue
Installation of
google-cloud-sdk
withbrew install --cask google-cloud-sdk
fails withError: Cask 'google-cloud-sdk' definition is invalid: installer missing executable
.It fails on this line of code: https://github.com/Homebrew/brew/blob/98999cc51033c6f1b2aae662024cba8544dcd3fd/Library/Homebrew/cask/artifact/installer.rb#L87
Indeed, at that point the
path
variable isnil
, and inspectingargs[:script]
is:Which in fact misses the
:executable
property, even though it is given in https://github.com/Homebrew/homebrew-cask/blob/6c8f16cfda7fe1760877c479ffe304ac63f33749/Casks/google-cloud-sdk.rb#L13Passing
args[:script].dup
instead ofargs[:script]
toread_script_arguments
on https://github.com/Homebrew/brew/blob/98999cc51033c6f1b2aae662024cba8544dcd3fd/Library/Homebrew/cask/artifact/installer.rb#L85 fixes the error, although it fails later withError: It seems the symlink source '/opt/homebrew/Caskroom/google-cloud-sdk/latest/$(brew --prefix)/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/completion.bash.inc' is not there.
Command that failed
brew install --cask google-cloud-sdk
Output of command with
--verbose --debug
Output of
brew doctor --verbose
Output of
brew tap