From ec2a7121abab227c944111e6f3fd84ade4206bc3 Mon Sep 17 00:00:00 2001 From: Sam Ford <1584702+samford@users.noreply.github.com> Date: Mon, 1 May 2023 10:45:13 -0400 Subject: [PATCH] BazaarDownloadStrategy: Replace in-place sub livecheck's `Git` strategy uses `DownloadStrategyDetector#detect` in its `#match?` method to check if a URL is a Git repository. This has historically worked fine but I've recently seen a `can't modify frozen String` error for a few formulae (percona-toolkit, schroedinger, squid) in relation to the in-place `sub` call in `BazaarDownloadStrategy`'s initializer. Other download strategies use a `@url = @url.sub(...)` pattern to avoid this issue, so this commit resolves the issue by using the same approach in `BazaarDownloadStrategy`. --- Library/Homebrew/download_strategy.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/Homebrew/download_strategy.rb b/Library/Homebrew/download_strategy.rb index 0b7ac2addf..699228d9f0 100644 --- a/Library/Homebrew/download_strategy.rb +++ b/Library/Homebrew/download_strategy.rb @@ -1277,7 +1277,7 @@ end class BazaarDownloadStrategy < VCSDownloadStrategy def initialize(url, name, version, **meta) super - @url.sub!(%r{^bzr://}, "") + @url = @url.sub(%r{^bzr://}, "") end # @see AbstractDownloadStrategy#source_modified_time