diff -Nru ruby-airbrussh-1.3.1/airbrussh.gemspec ruby-airbrussh-1.3.2/airbrussh.gemspec --- ruby-airbrussh-1.3.1/airbrussh.gemspec 2018-11-04 17:56:11.000000000 +0000 +++ ruby-airbrussh-1.3.2/airbrussh.gemspec 2019-06-15 19:42:25.000000000 +0100 @@ -23,7 +23,7 @@ spec.add_dependency "sshkit", [">= 1.6.1", "!= 1.7.0"] - spec.add_development_dependency "bundler", "~> 1.10" + spec.add_development_dependency "bundler", "~> 1.17" spec.add_development_dependency "rake", "~> 12.0" spec.add_development_dependency "minitest", "~> 5.10" spec.add_development_dependency "minitest-reporters", "~> 1.1" diff -Nru ruby-airbrussh-1.3.1/appveyor.yml ruby-airbrussh-1.3.2/appveyor.yml --- ruby-airbrussh-1.3.1/appveyor.yml 2018-11-04 17:56:11.000000000 +0000 +++ ruby-airbrussh-1.3.2/appveyor.yml 2019-06-15 19:42:25.000000000 +0100 @@ -9,7 +9,8 @@ install: - SET PATH=C:\Ruby%ruby_version%\bin;%PATH% - - gem install bundler --no-document --force + - gem uninstall bundler --all --executables + - gem install bundler --no-document -v "~>1.17" - bundle install --retry=3 test_script: diff -Nru ruby-airbrussh-1.3.1/CHANGELOG.md ruby-airbrussh-1.3.2/CHANGELOG.md --- ruby-airbrussh-1.3.1/CHANGELOG.md 2018-11-04 17:56:11.000000000 +0000 +++ ruby-airbrussh-1.3.2/CHANGELOG.md 2019-06-15 19:42:25.000000000 +0100 @@ -6,6 +6,10 @@ * Your contribution here! +## [1.3.2][] (2019-06-15) + +* [#121](https://github.com/mattbrictson/airbrussh/pull/121): Gracefully handle SSH output that has invalid UTF-8 encoding instead of raising an exception - [@mattbrictson](https://github.com/mattbrictson) + ## [1.3.1][] (2018-11-04) * Packaging changes to reduce gem size @@ -141,7 +145,8 @@ * Initial release [Semver]: http://semver.org -[Unreleased]: https://github.com/mattbrictson/airbrussh/compare/v1.3.1...HEAD +[Unreleased]: https://github.com/mattbrictson/airbrussh/compare/v1.3.2...HEAD +[1.3.2]: https://github.com/mattbrictson/airbrussh/compare/v1.3.1...v1.3.2 [1.3.1]: https://github.com/mattbrictson/airbrussh/compare/v1.3.0...v1.3.1 [1.3.0]: https://github.com/mattbrictson/airbrussh/compare/v1.2.0...v1.3.0 [1.2.0]: https://github.com/mattbrictson/airbrussh/compare/v1.1.2...v1.2.0 diff -Nru ruby-airbrussh-1.3.1/debian/changelog ruby-airbrussh-1.3.2/debian/changelog --- ruby-airbrussh-1.3.1/debian/changelog 2018-11-08 21:32:20.000000000 +0000 +++ ruby-airbrussh-1.3.2/debian/changelog 2019-06-20 18:49:37.000000000 +0100 @@ -1,3 +1,11 @@ +ruby-airbrussh (1.3.2-1) unstable; urgency=medium + + * New upstream version 1.3.2 + - Gracefully handle SSH output that has invalid UTF-8 encoding + instead of raising an exception. + + -- Samuel Henrique Thu, 20 Jun 2019 18:49:37 +0100 + ruby-airbrussh (1.3.1-2) unstable; urgency=medium * d/control: Build-Deps: require ruby-mocha >= 1.2 diff -Nru ruby-airbrussh-1.3.1/lib/airbrussh/console.rb ruby-airbrussh-1.3.2/lib/airbrussh/console.rb --- ruby-airbrussh-1.3.1/lib/airbrussh/console.rb 2018-11-04 17:56:11.000000000 +0000 +++ ruby-airbrussh-1.3.2/lib/airbrussh/console.rb 2019-06-15 19:42:25.000000000 +0100 @@ -53,7 +53,10 @@ end def strip_ascii_color(string) - (string || "").gsub(/\033\[[0-9;]*m/, "") + string ||= "" + string = to_utf8(string) unless string.valid_encoding? + + string.gsub(/\033\[[0-9;]*m/, "") end def console_width @@ -85,5 +88,10 @@ rescue Encoding::UndefinedConversionError false end + + def to_utf8(string) + string.force_encoding("ASCII-8BIT") + .encode("UTF-8", :invalid => :replace, :undef => :replace) + end end end diff -Nru ruby-airbrussh-1.3.1/lib/airbrussh/version.rb ruby-airbrussh-1.3.2/lib/airbrussh/version.rb --- ruby-airbrussh-1.3.1/lib/airbrussh/version.rb 2018-11-04 17:56:11.000000000 +0000 +++ ruby-airbrussh-1.3.2/lib/airbrussh/version.rb 2019-06-15 19:42:25.000000000 +0100 @@ -1,5 +1,5 @@ # frozen_string_literal: true module Airbrussh - VERSION = "1.3.1".freeze + VERSION = "1.3.2".freeze end diff -Nru ruby-airbrussh-1.3.1/LICENSE.txt ruby-airbrussh-1.3.2/LICENSE.txt --- ruby-airbrussh-1.3.1/LICENSE.txt 2018-11-04 17:56:11.000000000 +0000 +++ ruby-airbrussh-1.3.2/LICENSE.txt 2019-06-15 19:42:25.000000000 +0100 @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2018 Matt Brictson +Copyright (c) 2019 Matt Brictson Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff -Nru ruby-airbrussh-1.3.1/test/airbrussh/console_test.rb ruby-airbrussh-1.3.2/test/airbrussh/console_test.rb --- ruby-airbrussh-1.3.1/test/airbrussh/console_test.rb 2018-11-04 17:56:11.000000000 +0000 +++ ruby-airbrussh-1.3.2/test/airbrussh/console_test.rb 2019-06-15 19:42:25.000000000 +0100 @@ -106,6 +106,17 @@ assert_equal(ascii_8bit("The ‘...\n"), ascii_8bit(output)) end + def test_print_line_handles_invalid_utf8 + console = configured_console(:tty => false) + + invalid_utf8 = "The ‘quick’ brown fox" + .encode("Windows-1255") + .force_encoding("UTF-8") + + console.print_line(invalid_utf8) + assert_equal("The �quick� brown fox\n", output) + end + def test_doesnt_truncates_to_zero_width console = configured_console(:tty => true) do |config| config.color = false diff -Nru ruby-airbrussh-1.3.1/.travis.yml ruby-airbrussh-1.3.2/.travis.yml --- ruby-airbrussh-1.3.1/.travis.yml 2018-11-04 17:56:11.000000000 +0000 +++ ruby-airbrussh-1.3.2/.travis.yml 2019-06-15 19:42:25.000000000 +0100 @@ -5,10 +5,10 @@ - 1.9 - 2.0 - 2.1 - - 2.2.9 - - 2.3.6 - - 2.4.3 - - 2.5.0 + - 2.2.10 + - 2.3.8 + - 2.4.5 + - 2.5.3 - ruby-head env: - sshkit="master" @@ -17,13 +17,13 @@ matrix: exclude: # Older versions of SSHKit don't work with Ruby 2.4+, so skip those - - rvm: 2.4.3 + - rvm: 2.4.5 env: sshkit="= 1.7.1" - - rvm: 2.4.3 + - rvm: 2.4.5 env: sshkit="= 1.6.1" - - rvm: 2.5.0 + - rvm: 2.5.3 env: sshkit="= 1.7.1" - - rvm: 2.5.0 + - rvm: 2.5.3 env: sshkit="= 1.6.1" - rvm: ruby-head env: sshkit="= 1.7.1" @@ -33,10 +33,13 @@ - rvm: 1.9 env: sshkit="master" include: - # Run Danger only once, on 2.4.3 - - rvm: 2.4.3 + # Run Danger only once, on 2.4.5 + - rvm: 2.4.5 script: bundle exec danger before_install: - - gem update --system - - gem install bundler --no-document + - gem update --system || echo "skipping rubygems upgrade" + - gem install bundler -v 1.17.3 --conservative --no-document + - gem install executable-hooks --conservative --no-document +install: + - bundle _1.17.3_ install --jobs=3 --retry=3 --path=${BUNDLE_PATH:-vendor/bundle} || bundle install --jobs=3 --retry=3 --path=${BUNDLE_PATH:-vendor/bundle}