From c65b3f3f13f91682d3b136387028cd3a4c782615 Mon Sep 17 00:00:00 2001 From: Issy Long Date: Tue, 14 Jan 2020 22:04:51 +0000 Subject: [PATCH] cmd/gist-logs: Fix bug with parsing of command-line arguments - A user reported the following error when running `brew gist-logs`, reproducible with any formula: ``` $ brew gist-logs rustup-init Error: undefined method `length' for nil:NilClass Please report this bug: https://docs.brew.sh/Troubleshooting /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/cmd/gist-logs.rb:145:in `gist_logs' /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/brew.rb:102:in ``` - From what I can tell, `gist_logs_args.parse` had ended up in the wrong method. The `gistify_logs` method already has `formula` (ie the formula name) passed into it. But it's the `gist_logs` method that needs to do the argument parsing. This was discovered by looking at some other recently changed ARGV => Homebrew.args code like cmd/info. --- Library/Homebrew/cmd/gist-logs.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Library/Homebrew/cmd/gist-logs.rb b/Library/Homebrew/cmd/gist-logs.rb index a62e420451..6cb0a6c21d 100644 --- a/Library/Homebrew/cmd/gist-logs.rb +++ b/Library/Homebrew/cmd/gist-logs.rb @@ -33,8 +33,6 @@ module Homebrew end def gistify_logs(f) - gist_logs_args.parse - files = load_logs(f.logs) build_time = f.logs.ctime timestamp = build_time.strftime("%Y-%m-%d_%H-%M-%S") @@ -142,6 +140,8 @@ module Homebrew end def gist_logs + gist_logs_args.parse + raise FormulaUnspecifiedError if Homebrew.args.resolved_formulae.length != 1 Install.perform_preinstall_checks(all_fatal: true)