Skip to content

Commit

Permalink
Merge pull request #179336 from Homebrew/c-interpolated-bin-audit
Browse files Browse the repository at this point in the history
c*: Stop interpolating `bin`
  • Loading branch information
p-linnane authored Aug 1, 2024
2 parents 2721b39 + 3dd7eb1 commit 4e476c6
Show file tree
Hide file tree
Showing 64 changed files with 70 additions and 70 deletions.
2 changes: 1 addition & 1 deletion Formula/c/c10t.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def install
end

test do
system "#{bin}/c10t", "--list-colors"
system bin/"c10t", "--list-colors"
end
end

Expand Down
2 changes: 1 addition & 1 deletion Formula/c/cabextract.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def install
EOS
(testpath/"test.cab").binwrite [cab].pack("H*")

system "#{bin}/cabextract", "test.cab"
system bin/"cabextract", "test.cab"
assert_predicate testpath/"a", :exist?
end
end
2 changes: 1 addition & 1 deletion Formula/c/cadence.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,6 @@ def install
return 0
}
EOS
system "#{bin}/cadence", "hello.cdc"
system bin/"cadence", "hello.cdc"
end
end
2 changes: 1 addition & 1 deletion Formula/c/calabash.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,6 @@ def install
test do
# This small XML pipeline (*.xpl) that comes with Calabash
# is basically its equivalent "Hello World" program.
system "#{bin}/calabash", "#{libexec}/xpl/pipe.xpl"
system bin/"calabash", "#{libexec}/xpl/pipe.xpl"
end
end
2 changes: 1 addition & 1 deletion Formula/c/capnp.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def install
email @2 :Text;
}
EOS
system "#{bin}/capnp", "compile", "-oc++", testpath/"person.capnp"
system bin/"capnp", "compile", "-oc++", testpath/"person.capnp"

(testpath/"test.cpp").write <<~EOS
#include "person.capnp.h"
Expand Down
2 changes: 1 addition & 1 deletion Formula/c/cargo-fuzz.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def install
system "rustup", "set", "profile", "minimal"

system "cargo", "init"
system "#{bin}/cargo-fuzz", "init"
system bin/"cargo-fuzz", "init"
assert_predicate testpath/"fuzz/Cargo.toml", :exist?
end
end
2 changes: 1 addition & 1 deletion Formula/c/cariddi.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def install
end

test do
output = pipe_output("#{bin}/cariddi", "http://testphp.vulnweb.com")
output = pipe_output(bin/"cariddi", "http://testphp.vulnweb.com")
assert_match "http://testphp.vulnweb.com/login.php", output

assert_match version.to_s, shell_output("#{bin}/cariddi -version 2>&1")
Expand Down
2 changes: 1 addition & 1 deletion Formula/c/cassowary.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def install
end

test do
system("#{bin}/cassowary", "run", "-u", "http://www.example.com", "-c", "10", "-n", "100", "--json-metrics")
system(bin/"cassowary", "run", "-u", "http://www.example.com", "-c", "10", "-n", "100", "--json-metrics")
assert_match "\"base_url\":\"http://www.example.com\"", File.read("#{testpath}/out.json")

assert_match version.to_s, shell_output("#{bin}/cassowary --version")
Expand Down
2 changes: 1 addition & 1 deletion Formula/c/catimg.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ def install
end

test do
system "#{bin}/catimg", test_fixtures("test.png")
system bin/"catimg", test_fixtures("test.png")
end
end
2 changes: 1 addition & 1 deletion Formula/c/cayley.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def post_install

http_port = free_port
fork do
exec "#{bin}/cayley", "http", "--host=127.0.0.1:#{http_port}"
exec bin/"cayley", "http", "--host=127.0.0.1:#{http_port}"
end
sleep 3
response = shell_output("curl -s -i 127.0.0.1:#{http_port}")
Expand Down
2 changes: 1 addition & 1 deletion Formula/c/cbmbasic.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ def install
end

test do
assert_match(/READY.\r\n 1/, pipe_output("#{bin}/cbmbasic", "PRINT 1\n", 0))
assert_match(/READY.\r\n 1/, pipe_output(bin/"cbmbasic", "PRINT 1\n", 0))
end
end
2 changes: 1 addition & 1 deletion Formula/c/ccache.rb
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,6 @@ def caveats
test do
ENV.prepend_path "PATH", opt_libexec
assert_equal "#{opt_libexec}/gcc", shell_output("which gcc").chomp
system "#{bin}/ccache", "-s"
system bin/"ccache", "-s"
end
end
2 changes: 1 addition & 1 deletion Formula/c/ccm.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,6 @@ def install
end

test do
assert_match "Usage", shell_output("#{bin}/ccm", 1)
assert_match "Usage", shell_output(bin/"ccm", 1)
end
end
2 changes: 1 addition & 1 deletion Formula/c/cdargs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,6 @@ def caveats
end

test do
system "#{bin}/cdargs", "--version"
system bin/"cdargs", "--version"
end
end
2 changes: 1 addition & 1 deletion Formula/c/cdo.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def install
R1JJQgABvAEAABz/AAD/gAEBAABkAAAAAAEAAAoAAAAAAAAAAAAgAP8AABIACgB+9IBrbIABLrwA4JwTiBOIQAAAAAAAAXQIgAPEFI2rEBm9AACVLSuNtwvRALldqDul2GV1pw1CbXsdub2q9a/17Yi9o11DE0UFWwRjqsvH80wgS82o3UJ9rkitLcPgxJDVaO9No4XV6EWNPeUSSC7txHi7/aglVaO5uKKtwr2slV5DYejEoKOwpdirLXPIGUAWCya7ntil1amLu4PCtafNp5OpPafFqVWmxaQto72sMzGQJeUxcJkbqEWnOKM9pTOlTafdqPCoc6tAq0WqFarTq2i5M1NdRq2AHWzFpFWj1aJtmAOrhaJzox2nwKr4qQWofaggqz2rkHcog2htuI2YmOB9hZDIpxXA3ahdpzOnDarjqj2k0KlIqM2oyJsjjpODmGu1YtU6WHmNZ5uljcbVrduuOK1DrDWjGKM4pQCmfdVFprWbnVd7Vw1QY1s9VnNzvZiLmGucPZwVnM2bm5yFqb2cHdRQqs2hhZrrm1VGeEQgOduhjbWrqAWfzaANnZOdWJ0NnMWeJQA3Nzc3AAAAAA==
EOF
File.binwrite("test.grb", data)
system "#{bin}/cdo", "-f", "nc", "copy", "test.grb", "test.nc"
system bin/"cdo", "-f", "nc", "copy", "test.grb", "test.nc"
assert_predicate testpath/"test.nc", :exist?
end
end
2 changes: 1 addition & 1 deletion Formula/c/cdparanoia.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,6 @@ def install
end

test do
system "#{bin}/cdparanoia", "--version"
system bin/"cdparanoia", "--version"
end
end
2 changes: 1 addition & 1 deletion Formula/c/cdpr.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ def caveats
end

test do
system "#{bin}/cdpr", "-h"
system bin/"cdpr", "-h"
end
end
2 changes: 1 addition & 1 deletion Formula/c/cekit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def install
EOS
assert_match "INFO Finished!",
shell_output("#{bin}/cekit --descriptor #{testpath}/test.yml build --dry-run docker 2>&1")
system "#{bin}/cekit", "--descriptor", "#{testpath}/test.yml", "build", "--dry-run", "docker"
system bin/"cekit", "--descriptor", "#{testpath}/test.yml", "build", "--dry-run", "docker"
assert_predicate testpath/"target/image/Dockerfile", :exist?
assert_match "FROM scratch", File.read(testpath/"target/image/Dockerfile")
end
Expand Down
2 changes: 1 addition & 1 deletion Formula/c/certstrap.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@ def install
end

test do
system "#{bin}/certstrap", "init", "--common-name", "Homebrew Test CA", "--passphrase", "beerformyhorses"
system bin/"certstrap", "init", "--common-name", "Homebrew Test CA", "--passphrase", "beerformyhorses"
end
end
6 changes: 3 additions & 3 deletions Formula/c/ceylon.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ def install

test do
cd "#{libexec}/samples/helloworld" do
system "#{bin}/ceylon", "compile", "--out", "#{testpath}/modules",
system bin/"ceylon", "compile", "--out", "#{testpath}/modules",
"--encoding", "UTF-8",
"com.example.helloworld"
system "#{bin}/ceylon", "doc", "--out", "#{testpath}/modules",
system bin/"ceylon", "doc", "--out", "#{testpath}/modules",
"--encoding", "UTF-8", "--non-shared",
"com.example.helloworld"
system "#{bin}/ceylon", "run", "--rep", "#{testpath}/modules",
system bin/"ceylon", "run", "--rep", "#{testpath}/modules",
"com.example.helloworld/1.0", "John"
end
end
Expand Down
2 changes: 1 addition & 1 deletion Formula/c/cgdb.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,6 @@ def install
end

test do
system "#{bin}/cgdb", "--version"
system bin/"cgdb", "--version"
end
end
2 changes: 1 addition & 1 deletion Formula/c/cheops.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ def install
end

test do
system "#{bin}/cheops", "--version"
system bin/"cheops", "--version"
end
end
2 changes: 1 addition & 1 deletion Formula/c/cherrytree.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def install
</node>
</cherrytree>
EOS
system "#{bin}/cherrytree", testpath/"homebrew.ctd", "--export_to_txt_dir", testpath, "--export_single_file"
system bin/"cherrytree", testpath/"homebrew.ctd", "--export_to_txt_dir", testpath, "--export_single_file"
assert_predicate testpath/"homebrew.ctd.txt", :exist?
assert_match "rich text", (testpath/"homebrew.ctd.txt").read
assert_match "this is a simple command line test for homebrew", (testpath/"homebrew.ctd.txt").read
Expand Down
2 changes: 1 addition & 1 deletion Formula/c/chezmoi.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def install
assert_match "version v#{version}", shell_output("#{bin}/chezmoi --version")
assert_match "built by #{tap.user}", shell_output("#{bin}/chezmoi --version")

system "#{bin}/chezmoi", "init"
system bin/"chezmoi", "init"
assert_predicate testpath/".local/share/chezmoi", :exist?
end
end
2 changes: 1 addition & 1 deletion Formula/c/choose.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,6 @@ def install
# [Errno 6] No such device or address: '/dev/tty'
return if OS.linux? && ENV["HOMEBREW_GITHUB_ACTIONS"]

assert_equal "homebrew-test", pipe_output("#{bin}/choose", "homebrew-test\n").strip
assert_equal "homebrew-test", pipe_output(bin/"choose", "homebrew-test\n").strip
end
end
2 changes: 1 addition & 1 deletion Formula/c/chrome-cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@ def install
end

test do
system "#{bin}/chrome-cli", "version"
system bin/"chrome-cli", "version"
end
end
2 changes: 1 addition & 1 deletion Formula/c/chrpath.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def install
assert_match "a.out: RPATH=/usr/local/lib", shell_output("#{bin}/chrpath a.out")
assert_match "a.out: new RPATH: /usr/lib/", shell_output("#{bin}/chrpath -r /usr/lib/ a.out")
assert_match "a.out: RPATH=/usr/lib/", shell_output("#{bin}/chrpath a.out")
system "#{bin}/chrpath", "-d", "a.out"
system bin/"chrpath", "-d", "a.out"
assert_match "a.out: no rpath or runpath tag found.", shell_output("#{bin}/chrpath a.out", 2)
end
end
2 changes: 1 addition & 1 deletion Formula/c/cidrmerge.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@ def install
192.1.4.5/32
192.1.4.4/32
EOS
assert_equal "10.1.1.0/24\n192.1.4.4/31\n", pipe_output("#{bin}/cidrmerge", input)
assert_equal "10.1.1.0/24\n192.1.4.4/31\n", pipe_output(bin/"cidrmerge", input)
end
end
2 changes: 1 addition & 1 deletion Formula/c/cifer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def install
end

test do
assert_match version.to_s, pipe_output("#{bin}/cifer")
assert_match version.to_s, pipe_output(bin/"cifer")
end
end

Expand Down
2 changes: 1 addition & 1 deletion Formula/c/cig.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,6 @@ def install
(testpath/".cig.yaml").write <<~EOS
test_project: #{repo_path}
EOS
system "#{bin}/cig", "--cp=#{testpath}"
system bin/"cig", "--cp=#{testpath}"
end
end
4 changes: 2 additions & 2 deletions Formula/c/clash.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ def install
password: "test"
cipher: chacha20-ietf-poly1305
EOS
system "#{bin}/clash", "-t", "-d", testpath # test config && download Country.mmdb
client = fork { exec "#{bin}/clash", "-d", testpath }
system bin/"clash", "-t", "-d", testpath # test config && download Country.mmdb
client = fork { exec bin/"clash", "-d", testpath }

sleep 3
begin
Expand Down
2 changes: 1 addition & 1 deletion Formula/c/clib.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ def install
end

test do
system "#{bin}/clib", "install", "stephenmathieson/rot13.c"
system bin/"clib", "install", "stephenmathieson/rot13.c"
end
end
2 changes: 1 addition & 1 deletion Formula/c/clip.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def install

test do
cp_r pkgshare/"test", testpath
system "#{bin}/clip", "--export", "chart.svg",
system bin/"clip", "--export", "chart.svg",
"test/examples/charts_basic_areachart.clp"
assert_predicate testpath/"chart.svg", :exist?
end
Expand Down
2 changes: 1 addition & 1 deletion Formula/c/clojure-lsp.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def install
}
JSON

Open3.popen3("#{bin}/clojure-lsp") do |stdin, stdout|
Open3.popen3(bin/"clojure-lsp") do |stdin, stdout|
stdin.write "Content-Length: #{json.size}\r\n\r\n#{json}"
assert_match(/^Content-Length: \d+/i, stdout.readline)
end
Expand Down
2 changes: 1 addition & 1 deletion Formula/c/cloudlist.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def install
test do
assert_match version.to_s, shell_output("#{bin}/cloudlist -version 2>&1")

output = shell_output "#{bin}/cloudlist", 1
output = shell_output bin/"cloudlist", 1
assert_match output, "invalid provider configuration file provided"
end
end
2 changes: 1 addition & 1 deletion Formula/c/cmake-language-server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def install
"processId\":88075,\"rootUri\":null,\"capabilities\":{},\"trace\":\"ver" \
"bose\",\"workspaceFolders\":null}}\r\n"

output = pipe_output("#{bin}/cmake-language-server", input)
output = pipe_output(bin/"cmake-language-server", input)

assert_match(/^Content-Length: \d+/i, output)

Expand Down
2 changes: 1 addition & 1 deletion Formula/c/cmark.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def install
end

test do
output = pipe_output("#{bin}/cmark", "*hello, world*")
output = pipe_output(bin/"cmark", "*hello, world*")
assert_equal "<p><em>hello, world</em></p>", output.chomp
end
end
2 changes: 1 addition & 1 deletion Formula/c/cmatrix.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@ def install
end

test do
system "#{bin}/cmatrix", "-V"
system bin/"cmatrix", "-V"
end
end
4 changes: 2 additions & 2 deletions Formula/c/cmix.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ def install

test do
(testpath/"foo").write "test"
system "#{bin}/cmix", "-c", "foo", "foo.cmix"
system "#{bin}/cmix", "-d", "foo.cmix", "foo.unpacked"
system bin/"cmix", "-c", "foo", "foo.cmix"
system bin/"cmix", "-d", "foo.cmix", "foo.unpacked"
assert_equal "test", shell_output("cat foo.unpacked")
end
end
2 changes: 1 addition & 1 deletion Formula/c/colmap.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def install
end

test do
system "#{bin}/colmap", "database_creator", "--database_path", (testpath / "db")
system bin/"colmap", "database_creator", "--database_path", (testpath / "db")
assert_path_exists (testpath / "db")
end
end
Expand Down
2 changes: 1 addition & 1 deletion Formula/c/colordiff.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ def install
test do
cp HOMEBREW_PREFIX+"bin/brew", "brew1"
cp HOMEBREW_PREFIX+"bin/brew", "brew2"
system "#{bin}/colordiff", "brew1", "brew2"
system bin/"colordiff", "brew1", "brew2"
end
end
2 changes: 1 addition & 1 deletion Formula/c/colormake.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ def install

test do
(testpath/"Makefile").write("all:\n\techo Hello World!\n")
assert_match "Hello World!", shell_output("#{bin}/colormake")
assert_match "Hello World!", shell_output(bin/"colormake")
end
end
2 changes: 1 addition & 1 deletion Formula/c/commitlint.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@ def install
};
EOS
assert_match version.to_s, shell_output("#{bin}/commitlint --version")
assert_equal "", pipe_output("#{bin}/commitlint", "foo: message")
assert_equal "", pipe_output(bin/"commitlint", "foo: message")
end
end
2 changes: 1 addition & 1 deletion Formula/c/compiledb.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def install
int main(void) { return 0; }
EOS

system "#{bin}/compiledb", "-n", "make"
system bin/"compiledb", "-n", "make"
assert_predicate testpath/"compile_commands.json", :exist?, "compile_commands.json should be created"
end
end
2 changes: 1 addition & 1 deletion Formula/c/composer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class Greetings {
echo Greetings::sayHelloWorld();
EOS

system "#{bin}/composer", "install"
system bin/"composer", "install"
assert_match(/^HelloHomebrew$/, shell_output("php tests/test.php"))
end
end
Loading

0 comments on commit 4e476c6

Please sign in to comment.