Downcase internal commands

Since APFS is case-insensitive by default, Ruby will load the command file
if user passes it mixed-case, but invoking it later will fail.
This commit is contained in:
Michał Lach 2024-11-03 13:29:47 +01:00
parent 4d0deeb68e
commit d0e438c5fa
No known key found for this signature in database
GPG Key ID: 2D3BE1DDCBB1AFEE

View File

@ -83,7 +83,10 @@ begin
end end
if internal_cmd || Commands.external_ruby_v2_cmd_path(cmd) if internal_cmd || Commands.external_ruby_v2_cmd_path(cmd)
cmd = T.must(cmd) # All internal commands are downcased
# Since APFS is case-insensitive by default, Ruby will load the command file
# if user passes it mixed-case, but here invoking it will fail.
cmd = T.must(cmd).downcase
cmd_class = Homebrew::AbstractCommand.command(cmd) cmd_class = Homebrew::AbstractCommand.command(cmd)
Homebrew.running_command = cmd Homebrew.running_command = cmd
if cmd_class if cmd_class