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

Unable to install yandex-cloud-cli cask #173982

Closed
6 tasks done
jbfavre opened this issue May 16, 2024 · 4 comments · Fixed by #174014
Closed
6 tasks done

Unable to install yandex-cloud-cli cask #173982

jbfavre opened this issue May 16, 2024 · 4 comments · Fixed by #174014
Labels
bug Issue describing a reproducible bug. core Issue with Homebrew itself rather than with a specific cask.

Comments

@jbfavre
Copy link
Contributor

jbfavre commented May 16, 2024

Verification

Description of issue

Trying to install yandex-cloud-cli cask on a brand new Mac ends up with following error:

 brew install yandex-cloud-cli
==> Downloading https://formulae.brew.sh/api/formula.jws.json
############################################################################################################### 100.0%
==> Downloading https://formulae.brew.sh/api/cask.jws.json
############################################################################################################### 100.0%
==> Caveats
To install shell completions add this to your profile:

  for bash users
    source "/opt/homebrew/Caskroom/yandex-cloud-cli/0.123.0/yandex-cloud-cli/completion.bash.inc"

  for zsh users
    source "/opt/homebrew/Caskroom/yandex-cloud-cli/0.123.0/yandex-cloud-cli/completion.zsh.inc"

==> Downloading https://storage.yandexcloud.net/yandexcloud-yc/install.sh
Already downloaded: /Users/jean-baptistefavre/Library/Caches/Homebrew/downloads/e0e68b066c559c1f3270ca5dda658681b4ba835addcd465d99f828ce47298c55--install.sh
Warning: No checksum defined for cask 'yandex-cloud-cli', skipping verification.
==> Installing Cask yandex-cloud-cli
==> Running installer script 'yandex-cloud-cli/bin/yc'
env: yandex-cloud-cli/bin/yc: No such file or directory
==> Purging files for version 0.123.0 of Cask yandex-cloud-cli
Error: Failure while executing; `/usr/bin/env PATH=/opt/homebrew/bin:/opt/homebrew/sbin:/opt/homebrew/Library/Homebrew/shims/shared:/usr/bin:/bin:/usr/sbin:/sbin yandex-cloud-cli/bin/yc components post-update` exited with 127. Here's the output:
env: yandex-cloud-cli/bin/yc: No such file or directory

I'm not familiar with how brew works, so it's hard for me to fix the issue

Command that failed

brew install yandex-cloud-cli

Output of command with --verbose --debug

brew install --cask yandex-cloud-cli --verbose --
debug
/opt/homebrew/Library/Homebrew/brew.rb (Cask::CaskLoader::FromAPILoader): loading yandex-cloud-cli
==> Cask::Installer#install
==> Printing caveats
==> Caveats
To install shell completions add this to your profile:

  for bash users
    source "/opt/homebrew/Caskroom/yandex-cloud-cli/0.123.0/yandex-cloud-cli/completion.bash.inc"

  for zsh users
    source "/opt/homebrew/Caskroom/yandex-cloud-cli/0.123.0/yandex-cloud-cli/completion.zsh.inc"

==> Cask::Installer#fetch
==> Downloading https://storage.yandexcloud.net/yandexcloud-yc/install.sh
/usr/bin/env /opt/homebrew/Library/Homebrew/shims/shared/curl --disable --cookie /dev/null --globoff --show-error --user-agent Homebrew/4.3.0\ \(Macintosh\;\ arm64\ Mac\ OS\ X\ 14.5\)\ curl/8.6.0 --header Accept-Language:\ en --retry 3 --fail --location --silent --head https://storage.yandexcloud.net/yandexcloud-yc/install.sh
/usr/bin/env /opt/homebrew/Library/Homebrew/shims/shared/curl --disable --cookie /dev/null --globoff --show-error --user-agent Homebrew/4.3.0\ \(Macintosh\;\ arm64\ Mac\ OS\ X\ 14.5\)\ curl/8.6.0 --header Accept-Language:\ en --retry 3 --fail --location --silent --head --request GET https://storage.yandexcloud.net/yandexcloud-yc/install.sh
Already downloaded: /Users/jean-baptistefavre/Library/Caches/Homebrew/downloads/e0e68b066c559c1f3270ca5dda658681b4ba835addcd465d99f828ce47298c55--install.sh
==> Checking quarantine support
/usr/bin/env /usr/bin/xattr -h
/usr/bin/env /Library/Developer/CommandLineTools/usr/bin/swift -target arm64-apple-macosx14 /opt/homebrew/Library/Homebrew/cask/utils/quarantine.swift
==> Quarantine is available.
==> Verifying Gatekeeper status of /Users/jean-baptistefavre/Library/Caches/Homebrew/downloads/e0e68b066c559c1f3270ca5dda658681b4ba835addcd465d99f828ce47298c55--install.sh
/usr/bin/env /usr/bin/xattr -p com.apple.quarantine /Users/jean-baptistefavre/Library/Caches/Homebrew/downloads/e0e68b066c559c1f3270ca5dda658681b4ba835addcd465d99f828ce47298c55--install.sh
==> /Users/jean-baptistefavre/Library/Caches/Homebrew/downloads/e0e68b066c559c1f3270ca5dda658681b4ba835addcd465d99f828ce47298c55--install.sh is quarantined
Warning: No checksum defined for cask 'yandex-cloud-cli', skipping verification.
/usr/bin/env hdiutil imageinfo -format /Users/jean-baptistefavre/Library/Caches/Homebrew/downloads/e0e68b066c559c1f3270ca5dda658681b4ba835addcd465d99f828ce47298c55--install.sh
==> Installing Cask yandex-cloud-cli
==> Cask::Installer#stage
==> Extracting primary container
==> Using container class UnpackStrategy::Executable for /Users/jean-baptistefavre/Library/Caches/Homebrew/downloads/e0e68b066c559c1f3270ca5dda658681b4ba835addcd465d99f828ce47298c55--install.sh
cp -p /Users/jean-baptistefavre/Library/Caches/Homebrew/downloads/e0e68b066c559c1f3270ca5dda658681b4ba835addcd465d99f828ce47298c55--install.sh /opt/homebrew/Caskroom/yandex-cloud-cli/0.123.0/install.sh
==> Verifying Gatekeeper status of /Users/jean-baptistefavre/Library/Caches/Homebrew/downloads/e0e68b066c559c1f3270ca5dda658681b4ba835addcd465d99f828ce47298c55--install.sh
/usr/bin/env /usr/bin/xattr -p com.apple.quarantine /Users/jean-baptistefavre/Library/Caches/Homebrew/downloads/e0e68b066c559c1f3270ca5dda658681b4ba835addcd465d99f828ce47298c55--install.sh
==> /Users/jean-baptistefavre/Library/Caches/Homebrew/downloads/e0e68b066c559c1f3270ca5dda658681b4ba835addcd465d99f828ce47298c55--install.sh is quarantined
==> Propagating quarantine from /Users/jean-baptistefavre/Library/Caches/Homebrew/downloads/e0e68b066c559c1f3270ca5dda658681b4ba835addcd465d99f828ce47298c55--install.sh to /opt/homebrew/Caskroom/yandex-cloud-cli/0.123.0
/usr/bin/env /usr/bin/xattr -p com.apple.quarantine /Users/jean-baptistefavre/Library/Caches/Homebrew/downloads/e0e68b066c559c1f3270ca5dda658681b4ba835addcd465d99f828ce47298c55--install.sh
/usr/bin/env /usr/bin/xargs -0 -- /bin/chmod -h u+w
/usr/bin/env /usr/bin/xargs -0 -- /usr/bin/xattr -w com.apple.quarantine 0381\;6645d545\;\;EC5DECBF-B30A-43D1-B4CD-A3C587BBC577
==> Creating metadata directory: /opt/homebrew/Caskroom/yandex-cloud-cli/.metadata/0.123.0/20240516094743.316
==> Creating metadata subdirectory: /opt/homebrew/Caskroom/yandex-cloud-cli/.metadata/0.123.0/20240516094743.316/Casks
==> Installing artifacts
==> Installing artifact of class Cask::Artifact::Installer
==> Running installer script 'yandex-cloud-cli/bin/yc'
/usr/bin/env PATH=/opt/homebrew/bin:/opt/homebrew/sbin:/opt/homebrew/Library/Homebrew/shims/shared:/usr/bin:/bin:/usr/sbin:/sbin yandex-cloud-cli/bin/yc components post-update
env: yandex-cloud-cli/bin/yc: No such file or directory
==> Purging files for version 0.123.0 of Cask yandex-cloud-cli
Error: Failure while executing; `/usr/bin/env PATH=/opt/homebrew/bin:/opt/homebrew/sbin:/opt/homebrew/Library/Homebrew/shims/shared:/usr/bin:/bin:/usr/sbin:/sbin yandex-cloud-cli/bin/yc components post-update` exited with 127. Here's the output:
env: yandex-cloud-cli/bin/yc: No such file or directory

/opt/homebrew/Library/Homebrew/system_command.rb:352:in `assert_success!'
/opt/homebrew/Library/Homebrew/system_command.rb:75:in `run!'
/opt/homebrew/Library/Homebrew/system_command.rb:40:in `run'
/opt/homebrew/Library/Homebrew/system_command.rb:44:in `run!'
/opt/homebrew/Library/Homebrew/cask/artifact/installer.rb:35:in `install_phase'
/opt/homebrew/Library/Homebrew/cask/installer.rb:248:in `block in install_artifacts'
/opt/homebrew/Library/Homebrew/cask/artifact_set.rb:12:in `each'
/opt/homebrew/Library/Homebrew/cask/artifact_set.rb:12:in `each'
/opt/homebrew/Library/Homebrew/cask/installer.rb:241:in `install_artifacts'
/opt/homebrew/Library/Homebrew/cask/installer.rb:113:in `install'
/opt/homebrew/Library/Homebrew/cmd/install.rb:246:in `block in run'
/opt/homebrew/Library/Homebrew/cmd/install.rb:235:in `each'
/opt/homebrew/Library/Homebrew/cmd/install.rb:235:in `run'
/opt/homebrew/Library/Homebrew/brew.rb:92:in `<main>'

Output of brew doctor and brew config

brew doctor
Your system is ready to brew.
 brew config
HOMEBREW_VERSION: 4.3.0
ORIGIN: https://github.com/Homebrew/brew
HEAD: 8378cc825d83acffd125fb0fec041793df378a57
Last commit: 2 days ago
Core tap JSON: 16 May 09:43 UTC
Core cask tap JSON: 16 May 09:43 UTC
HOMEBREW_PREFIX: /opt/homebrew
HOMEBREW_CASK_OPTS: []
HOMEBREW_MAKE_JOBS: 8
Homebrew Ruby: 3.1.4 => /opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.1.4/bin/ruby
CPU: octa-core 64-bit arm_ibiza
Clang: 15.0.0 build 1500
Git: 2.45.1 => /opt/homebrew/bin/git
Curl: 8.6.0 => /usr/bin/curl
macOS: 14.5-arm64
CLT: 15.3.0.0.1.1708646388
Xcode: N/A
Rosetta 2: false

Output of brew tap

derailed/k9s
fluxcd/tap
@bevanjkay
Copy link
Member

bevanjkay commented May 16, 2024

Thanks @jbfavre for the report, it's definitely a bug in Brew from what I can see.


@Bo98 Are you able to help here?

I think I've found the issue, but I can't work out the solution.

https://github.com/Homebrew/brew/blob/9b995947532ac067c3361cfa39e6a9d10491c77f/Library/Homebrew/cask/artifact_set.rb#L19
The ArtifactSet.new class seems to be re-ordering the installer script stanzas when yandex-cloud-cli is loaded from the API. The second stanza is being fired first, causing the install to fail. They should fire in the same order as the caskfile, which they do when loaded from the ruby version.

https://github.com/Homebrew/homebrew-cask/blob/master/Casks/y/yandex-cloud-cli.rb#L18-L25

@bevanjkay bevanjkay added bug Issue describing a reproducible bug. core Issue with Homebrew itself rather than with a specific cask. labels May 16, 2024
@Bo98
Copy link
Member

Bo98 commented May 16, 2024

The order in a cask file is ignored. There is a specific order defined:

https://github.com/Homebrew/brew/blob/1fac68348a61f735066ba58e6ba35d2cec8bdf8c/Library/Homebrew/cask/artifact/abstract_artifact.rb#L60-L92

When you have two DSLs with the same type, the order is currently undefined - it's not a stable sort and can execute in either order, API or not. We would need to sort by index as a second condition for that to be stable.

@Bo98
Copy link
Member

Bo98 commented May 16, 2024

Looking at install.sh, a hack that might work is -r /dev/null rather than -n as it seems that RC file modification also calls yc components post-update.

@jbfavre
Copy link
Contributor Author

jbfavre commented May 16, 2024

@Bo98 Thanks for sharing your idea.
I tested it and, as far as I can tell: it works!
I'll open a PR to propose the fix

jbfavre added a commit to jbfavre/homebrew-cask that referenced this issue May 16, 2024
Fixes Homebrew#173982
Plus bump to 0.124.0 version
@jbfavre jbfavre mentioned this issue May 16, 2024
9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue describing a reproducible bug. core Issue with Homebrew itself rather than with a specific cask.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants