From 1eb070e2575f908980db3cdae34ca78079990723 Mon Sep 17 00:00:00 2001 From: Ruoyu Zhong Date: Tue, 19 Aug 2025 16:42:01 +0800 Subject: [PATCH] diagnostic: don't expand tildes in cask env vars We double quote them so they don't get expanded. Also, use `sh_quote` to quote the variable values properly. --- Library/Homebrew/diagnostic.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Library/Homebrew/diagnostic.rb b/Library/Homebrew/diagnostic.rb index b3493664d9..bdefcd9ea3 100644 --- a/Library/Homebrew/diagnostic.rb +++ b/Library/Homebrew/diagnostic.rb @@ -1076,8 +1076,7 @@ module Homebrew cask_environment_variables = (locale_variables + environment_variables).sort.filter_map do |var| next unless ENV.key?(var) - var = %Q(#{var}="#{ENV.fetch(var)}") - user_tilde(var) + %Q(#{var}="#{Utils::Shell.sh_quote(ENV.fetch(var))}") end add_info "Cask Environment Variables:", cask_environment_variables