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>
This commit is contained in:
parent
e7947f4f92
commit
c0eb8a3bc8
@ -797,6 +797,20 @@ def check_git_version
|
|||||||
end
|
end
|
||||||
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
|
module Homebrew extend self
|
||||||
def doctor
|
def doctor
|
||||||
old_stdout = $stdout
|
old_stdout = $stdout
|
||||||
@ -842,6 +856,7 @@ module Homebrew extend self
|
|||||||
check_git_status
|
check_git_status
|
||||||
check_for_leopard_ssl
|
check_for_leopard_ssl
|
||||||
check_git_version
|
check_git_version
|
||||||
|
check_terminal_width
|
||||||
ensure
|
ensure
|
||||||
$stdout = old_stdout
|
$stdout = old_stdout
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user