aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorJack Nagel2011-11-10 19:44:57 -0600
committerJack Nagel2011-11-10 20:47:17 -0600
commitc0eb8a3bc8658b6581fefc5eb3431c9867ebd7f6 (patch)
tree3004d957e70666d384177346d8dec5d9dc2f48f3 /Library
parente7947f4f92aaca36a34cf5ad3fd90bd8075dfd9f (diff)
downloadbrew-c0eb8a3bc8658b6581fefc5eb3431c9867ebd7f6.tar.bz2
doctor: warn about wide terminals
A terminal width of 262 or greater can trigger a buffer overflow in curl's progress bar code, resulting in a segfault and aborted downloads. Warn about this. cf Homebrew/homebrew#8521. Signed-off-by: Jack Nagel <jacknagel@gmail.com>
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/cmd/doctor.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/Library/Homebrew/cmd/doctor.rb b/Library/Homebrew/cmd/doctor.rb
index 9bfc9b308..6c4dc4d43 100644
--- a/Library/Homebrew/cmd/doctor.rb
+++ b/Library/Homebrew/cmd/doctor.rb
@@ -797,6 +797,20 @@ def check_git_version
end
end
+def check_terminal_width
+ if `tput cols`.chomp.to_i > 262
+ puts <<-EOS.undent
+ Your terminal width is greater than 262 columns.
+
+ This can trigger a segfault in some versions of curl, which may cause
+ downloads to appear to fail.
+
+ You may want to adjust your terminal size.
+
+ EOS
+ end
+end
+
module Homebrew extend self
def doctor
old_stdout = $stdout
@@ -842,6 +856,7 @@ module Homebrew extend self
check_git_status
check_for_leopard_ssl
check_git_version
+ check_terminal_width
ensure
$stdout = old_stdout
end