Homebrew / homebrew-cask

🍻 A CLI workflow for the administration of macOS applications distributed as binaries
https://brew.sh
BSD 2-Clause "Simplified" License
20.94k stars 10.71k forks source link

Casks/android-studio.rb generates temp file with too long filename on Apple Silicon machines, causing error #118612

Closed tewson closed 2 years ago

tewson commented 2 years ago

Verification

Description of issue

On an Apple Silicon machine, running brew install homebrew/cask/android-studio (or brew reinstall) generates a temporary file with a filename that's longer than the OS limit. This causes an error below

Error: Download failed on Cask 'android-studio' with message: File name too long @ dir_s_rmdir - /opt/homebrew/var/homebrew/locks/80881f74c413c8e986cfefc7dd5c817a51af72e9d57a02e847fd55415ddab7ed--android-studio-2021.1.1.20-mac_arm.dmg?mh=5P&pl=19&shardbypass=yes&redirect_counter=1&cm2rm=sn-h5boxu-q0ce7s&req_id=2d9c9c9e4dcb0005&cms_redirect=yes&mip=213.79.62.112&mm=42&mn=sn-q0c7rn76&ms=onc&mt=1643899250&mv=m&mvi=3.incomplete.lock

A lot of characters in the filename seem to come from query params after the URL redirection.

Command that failed

brew install homebrew/cask/android-studio

Output of command with --verbose --debug

/opt/homebrew/Library/Homebrew/brew.rb (Formulary::TapLoader): loading /opt/homebrew/Library/Taps/homebrew/homebrew-cask/android-studio.rb
==> Cask::Installer#reinstall
==> Cask::Installer#install
==> Printing caveats
==> Cask::Installer#fetch
/opt/homebrew/Library/Homebrew/shims/shared/curl --disable --cookie /dev/null --globoff --show-error --user-agent Homebrew/3.3.13-44-g8e97f60\ \(Macintosh\;\ arm64\ Mac\ OS\ X\ 12.2\)\ curl/7.77.0 --header Accept-Language:\ en --retry 3 --location --silent --head --request GET https://redirector.gvt1.com/edgedl/android/studio/install/2021.1.1.20/android-studio-2021.1.1.20-mac_arm.dmg
Error: Download failed on Cask 'android-studio' with message: File name too long @ dir_s_rmdir - /opt/homebrew/var/homebrew/locks/80881f74c413c8e986cfefc7dd5c817a51af72e9d57a02e847fd55415ddab7ed--android-studio-2021.1.1.20-mac_arm.dmg?mh=5P&pl=19&shardbypass=yes&redirect_counter=1&cm2rm=sn-h5boxu-q0ce7s&req_id=ba0368e6842de51e&cms_redirect=yes&mip=213.79.62.112&mm=42&mn=sn-q0cedn7s&ms=onc&mt=1643900210&mv=m&mvi=3.incomplete.lock
/opt/homebrew/Library/Homebrew/download_strategy.rb:430:in `unlink'
/opt/homebrew/Library/Homebrew/download_strategy.rb:430:in `unlink'
/opt/homebrew/Library/Homebrew/download_strategy.rb:430:in `ensure in fetch'
/opt/homebrew/Library/Homebrew/download_strategy.rb:430:in `fetch'
/opt/homebrew/Library/Homebrew/cask/download.rb:25:in `fetch'
/opt/homebrew/Library/Homebrew/cask/installer.rb:178:in `download'
/opt/homebrew/Library/Homebrew/cask/installer.rb:74:in `fetch'
/opt/homebrew/Library/Homebrew/cask/installer.rb:105:in `install'
/opt/homebrew/Library/Homebrew/cask/installer.rb:149:in `reinstall'
/opt/homebrew/Library/Homebrew/cask/cmd/reinstall.rb:48:in `block in reinstall_casks'
/opt/homebrew/Library/Homebrew/cask/cmd/reinstall.rb:47:in `each'
/opt/homebrew/Library/Homebrew/cask/cmd/reinstall.rb:47:in `reinstall_casks'
/opt/homebrew/Library/Homebrew/cmd/reinstall.rb:154:in `reinstall'
/opt/homebrew/Library/Homebrew/brew.rb:110:in `<main>'

Output of brew doctor --verbose

==> Cask Environment Variables:
BUNDLE_PATH
CHRUBY_VERSION
GEM_HOME
GEM_PATH
HOMEBREW_CASK_OPTS
LC_ALL
PATH
RBENV_VERSION
RUBYLIB
RUBYOPT
RUBYPATH
SHELL
==> $LOAD_PATHS
/opt/homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.6.0/gems/warning-1.2.1/lib
/opt/homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.6.0/gems/tapioca-0.6.3/lib
/opt/homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.6.0/gems/yard-sorbet-0.6.1/lib
/opt/homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.6.0/gems/yard-0.9.27/lib
/opt/homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.6.0/gems/spoom-1.1.8/lib
/opt/homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.6.0/gems/thor-1.2.1/lib
/opt/homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.6.0/gems/sorbet-runtime-stub-0.2.0/lib
/opt/homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.6.0/gems/sorbet-0.5.9601/lib
/opt/homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.6.0/gems/sorbet-static-0.5.9601-universal-darwin-14/lib
/opt/homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.6.0/gems/simplecov-cobertura-2.1.0/lib
/opt/homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.6.0/gems/simplecov-0.21.2/lib
/opt/homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.6.0/gems/simplecov_json_formatter-0.1.3/lib
/opt/homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.6.0/gems/simplecov-html-0.12.3/lib
/opt/homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.6.0/gems/ruby-macho-3.0.0/lib
/opt/homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.6.0/gems/rubocop-sorbet-0.6.5/lib
/opt/homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.6.0/gems/rubocop-rspec-2.8.0/lib
/opt/homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.6.0/gems/rubocop-rails-2.13.2/lib
/opt/homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.6.0/gems/rubocop-performance-1.13.2/lib
/opt/homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.6.0/gems/rubocop-1.25.0/lib
/opt/homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.6.0/gems/unicode-display_width-2.1.0/lib
/opt/homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.6.0/gems/ruby-progressbar-1.11.0/lib
/opt/homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.6.0/gems/rubocop-ast-1.15.1/lib
/opt/homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.6.0/gems/rspec_junit_formatter-0.5.1/lib
/opt/homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.6.0/gems/rspec-wait-0.0.9/lib
/opt/homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.6.0/gems/rspec-sorbet-1.8.3/lib
/opt/homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.6.0/gems/rspec-retry-0.6.2/lib
/opt/homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.6.0/gems/rspec-its-1.3.0/lib
/opt/homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.6.0/gems/rspec-github-2.3.1/lib
/opt/homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.6.0/gems/rspec-3.10.0/lib
/opt/homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.6.0/gems/rspec-mocks-3.10.3/lib
/opt/homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.6.0/gems/rspec-expectations-3.10.2/lib
/opt/homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.6.0/gems/rspec-core-3.10.2/lib
/opt/homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.6.0/gems/rspec-support-3.10.3/lib
/opt/homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.6.0/gems/ronn-0.7.3/lib
/opt/homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.6.0/gems/rexml-3.2.5/lib
/opt/homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.6.0/gems/rdiscount-2.2.0.2/lib
/opt/homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.6.0/extensions/x86_64-darwin-14/2.6.0-static/rdiscount-2.2.0.2
/opt/homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.6.0/gems/rbi-0.0.11/lib
/opt/homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.6.0/gems/unparser-0.6.3/lib
/opt/homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.6.0/gems/rack-2.2.3/lib
/opt/homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.6.0/gems/pry-0.14.1/lib
/opt/homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.6.0/gems/plist-3.6.0/lib
/opt/homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.6.0/gems/patchelf-1.3.0/lib
/opt/homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.6.0/gems/parlour-6.0.1/lib
/opt/homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.6.0/gems/sorbet-runtime-0.5.9601/lib
/opt/homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.6.0/gems/rainbow-3.1.1/lib
/opt/homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.6.0/gems/parser-3.1.0.0/lib
/opt/homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.6.0/gems/parallel_tests-3.7.3/lib
/opt/homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.6.0/gems/parallel-1.21.0/lib
/opt/homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.6.0/gems/mustache-1.1.1/lib
/opt/homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.6.0/gems/method_source-1.0.0/lib
/opt/homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.6.0/gems/mechanize-2.8.4/lib
/opt/homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.6.0/gems/webrobots-0.1.2/lib
/opt/homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.6.0/gems/webrick-1.7.0/lib
/opt/homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.6.0/gems/rubyntlm-0.6.3/lib
/opt/homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.6.0/gems/nokogiri-1.13.1-x86_64-darwin/lib
/opt/homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.6.0/gems/racc-1.6.0/lib
/opt/homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.6.0/extensions/x86_64-darwin-14/2.6.0-static/racc-1.6.0
/opt/homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.6.0/gems/mini_portile2-2.7.1/lib
/opt/homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.6.0/gems/net-http-persistent-4.0.1/lib
/opt/homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.6.0/gems/net-http-digest_auth-1.4.1/lib
/opt/homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.6.0/gems/mime-types-3.4.1/lib
/opt/homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.6.0/gems/mime-types-data-3.2022.0105/lib
/opt/homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.6.0/gems/json_schemer-0.2.18/lib
/opt/homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.6.0/gems/uri_template-0.7.0/lib
/opt/homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.6.0/gems/http-cookie-1.0.4/lib
/opt/homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.6.0/gems/hpricot-0.8.6/lib
/opt/homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.6.0/extensions/x86_64-darwin-14/2.6.0-static/hpricot-0.8.6
/opt/homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.6.0/gems/hana-1.3.7/lib
/opt/homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.6.0/gems/elftools-1.1.3/lib
/opt/homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.6.0/gems/ecma-re-validator-0.4.0/lib
/opt/homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.6.0/gems/regexp_parser-2.2.0/lib
/opt/homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.6.0/gems/domain_name-0.5.20190701/lib
/opt/homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.6.0/gems/unf-0.1.4/lib
/opt/homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.6.0/gems/unf_ext-0.0.8/lib
/opt/homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.6.0/extensions/x86_64-darwin-14/2.6.0-static/unf_ext-0.0.8
/opt/homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.6.0/gems/docile-1.4.0/lib
/opt/homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.6.0/gems/diff-lcs-1.5.0/lib
/opt/homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.6.0/gems/did_you_mean-1.6.1/lib
/opt/homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.6.0/gems/connection_pool-2.2.5/lib
/opt/homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.6.0/gems/commander-4.6.0/lib
/opt/homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.6.0/gems/highline-2.0.3/lib
/opt/homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.6.0/gems/coderay-1.1.3/lib
/opt/homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.6.0/gems/byebug-11.1.3/lib
/opt/homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.6.0/extensions/x86_64-darwin-14/2.6.0-static/byebug-11.1.3
/opt/homebrew/Library/Homebrew/vendor/bundle/bundler/
/opt/homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.6.0/gems/bootsnap-1.10.3/lib
/opt/homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.6.0/extensions/x86_64-darwin-14/2.6.0-static/bootsnap-1.10.3
/opt/homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.6.0/gems/msgpack-1.4.4/lib
/opt/homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.6.0/extensions/x86_64-darwin-14/2.6.0-static/msgpack-1.4.4
/opt/homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.6.0/gems/bindata-2.4.10/lib
/opt/homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.6.0/gems/ast-2.4.2/lib
/opt/homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.6.0/gems/addressable-2.8.0/lib
/opt/homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.6.0/gems/public_suffix-4.0.6/lib
/opt/homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.6.0/gems/activesupport-6.1.4.4/lib
/opt/homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.6.0/gems/zeitwerk-2.5.4/lib
/opt/homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.6.0/gems/tzinfo-2.0.4/lib
/opt/homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.6.0/gems/minitest-5.15.0/lib
/opt/homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.6.0/gems/i18n-1.9.1/lib
/opt/homebrew/Library/Homebrew/vendor/bundle/bundler/../ruby/2.6.0/gems/concurrent-ruby-1.1.9/lib/concurrent-ruby
/Library/Ruby/Gems/2.6.0/gems/did_you_mean-1.3.0/lib
/Library/Ruby/Site/2.6.0
/Library/Ruby/Site/2.6.0/arm64e-darwin21
/Library/Ruby/Site/2.6.0/universal-darwin21
/Library/Ruby/Site
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/vendor_ruby/2.6.0
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/vendor_ruby/2.6.0/arm64e-darwin21
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/vendor_ruby/2.6.0/universal-darwin21
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/vendor_ruby
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/arm64e-darwin21
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/universal-darwin21
/opt/homebrew/Library/Homebrew
==> Homebrew Version
3.3.13-44-g8e97f60
==> macOS
12.2
==> SIP
Enabled
==> Homebrew Cask Staging Location
/opt/homebrew/Caskroom
==> Homebrew Cask Taps:
/opt/homebrew/Library/Taps/homebrew/homebrew-cask (3955 casks)
Your system is ready to brew.

Output of brew tap

homebrew/cask
homebrew/core
miccal commented 2 years ago

Please run brew cleanup -s and try again.

tewson commented 2 years ago

@miccal For some reason the issue went away on its own, but I'm pretty sure the cleanup command would've helped, too.

Thank you for your response!