Hello community, here is the log from the commit of package rubygem-sshkit for openSUSE:Factory checked in at 2016-11-17 12:43:06 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/rubygem-sshkit (Old) and /work/SRC/openSUSE:Factory/.rubygem-sshkit.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "rubygem-sshkit" Changes: -------- --- /work/SRC/openSUSE:Factory/rubygem-sshkit/rubygem-sshkit.changes 2016-10-10 16:23:12.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.rubygem-sshkit.new/rubygem-sshkit.changes 2016-11-17 12:43:07.000000000 +0100 @@ -1,0 +2,13 @@ +Thu Nov 3 05:52:56 UTC 2016 - [email protected] + +- updated to version 1.11.4 + see installed CHANGELOG.md + + ## [1.11.4][] (2016-11-02) + + * Use string interpolation for environment variables to avoid escaping issues + with sprintf + [PR #280](https://github.com/capistrano/sshkit/pull/280) + @Sinjo - Chris Sinjakli + +------------------------------------------------------------------- Old: ---- sshkit-1.11.3.gem New: ---- sshkit-1.11.4.gem ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ rubygem-sshkit.spec ++++++ --- /var/tmp/diff_new_pack.eU6lR7/_old 2016-11-17 12:43:08.000000000 +0100 +++ /var/tmp/diff_new_pack.eU6lR7/_new 2016-11-17 12:43:08.000000000 +0100 @@ -24,7 +24,7 @@ # Name: rubygem-sshkit -Version: 1.11.3 +Version: 1.11.4 Release: 0 %define mod_name sshkit %define mod_full_name %{mod_name}-%{version} ++++++ sshkit-1.11.3.gem -> sshkit-1.11.4.gem ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/CHANGELOG.md new/CHANGELOG.md --- old/CHANGELOG.md 2016-09-16 22:45:29.000000000 +0200 +++ new/CHANGELOG.md 2016-11-03 05:53:51.000000000 +0100 @@ -8,6 +8,13 @@ * Add your entries below here, remember to credit yourself however you want to be credited! +## [1.11.4][] (2016-11-02) + + * Use string interpolation for environment variables to avoid escaping issues + with sprintf + [PR #280](https://github.com/capistrano/sshkit/pull/280) + @Sinjo - Chris Sinjakli + ## [1.11.3][] (2016-09-16) * Fix known_hosts caching to match on the entire hostlist @@ -649,7 +656,8 @@ First release. -[Unreleased]: https://github.com/capistrano/sshkit/compare/v1.11.3...HEAD +[Unreleased]: https://github.com/capistrano/sshkit/compare/v1.11.4...HEAD +[1.11.4]: https://github.com/capistrano/sshkit/compare/v1.11.3...v1.11.4 [1.11.3]: https://github.com/capistrano/sshkit/compare/v1.11.2...v1.11.3 [1.11.2]: https://github.com/capistrano/sshkit/compare/v1.11.1...v1.11.2 [1.11.1]: https://github.com/capistrano/sshkit/compare/v1.11.0...v1.11.1 Files old/checksums.yaml.gz and new/checksums.yaml.gz differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/sshkit/backends/abstract.rb new/lib/sshkit/backends/abstract.rb --- old/lib/sshkit/backends/abstract.rb 2016-09-16 22:45:29.000000000 +0200 +++ new/lib/sshkit/backends/abstract.rb 2016-11-03 05:53:51.000000000 +0100 @@ -150,7 +150,7 @@ end def command(args, options) - SSHKit::Command.new(*[*args, options.merge({in: pwd_path, env: @env, host: @host, user: @user, group: @group})]) + SSHKit::Command.new(*args, options.merge({in: pwd_path, env: @env, host: @host, user: @user, group: @group})) end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/sshkit/command.rb new/lib/sshkit/command.rb --- old/lib/sshkit/command.rb 2016-09-16 22:45:29.000000000 +0200 +++ new/lib/sshkit/command.rb 2016-11-03 05:53:51.000000000 +0100 @@ -163,12 +163,12 @@ def with(&_block) return yield unless environment_hash.any? - sprintf("( export #{environment_string} ; %s )", yield) + "( export #{environment_string} ; #{yield} )" end def user(&_block) return yield unless options[:user] - "sudo -u #{options[:user]} #{environment_string + " " unless environment_string.empty?}-- sh -c '%s'" % %Q{#{yield}} + "sudo -u #{options[:user]} #{environment_string + " " unless environment_string.empty?}-- sh -c '#{yield}'" end def in_background(&_block) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/sshkit/host.rb new/lib/sshkit/host.rb --- old/lib/sshkit/host.rb 2016-09-16 22:45:29.000000000 +0200 +++ new/lib/sshkit/host.rb 2016-11-03 05:53:51.000000000 +0100 @@ -29,23 +29,7 @@ @hostname = "localhost" @user = ENV['USER'] || ENV['LOGNAME'] || ENV['USERNAME'] elsif !host_string_or_options_hash.is_a?(Hash) - suitable_parsers = [ - SimpleHostParser, - HostWithPortParser, - HostWithUsernameAndPortParser, - IPv6HostWithPortParser, - HostWithUsernameParser, - ].select do |p| - p.suitable?(host_string_or_options_hash) - end - - if suitable_parsers.any? - suitable_parsers.first.tap do |parser| - @user, @hostname, @port = parser.new(host_string_or_options_hash).attributes - end - else - raise UnparsableHostStringError, "Cannot parse host string #{host_string_or_options_hash}" - end + @user, @hostname, @port = first_suitable_parser(host_string_or_options_hash).attributes else host_string_or_options_hash.each do |key, value| if self.respond_to?("#{key}=") @@ -94,6 +78,11 @@ @properties ||= OpenStruct.new end + def first_suitable_parser(host) + parser = PARSERS.find{|p| p.suitable?(host) } + fail UnparsableHostStringError, "Cannot parse host string #{host}" if parser.nil? + parser.new(host) + end end # @private @@ -192,4 +181,12 @@ end end + PARSERS = [ + SimpleHostParser, + HostWithPortParser, + HostWithUsernameAndPortParser, + IPv6HostWithPortParser, + HostWithUsernameParser, + ].freeze + end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/sshkit/version.rb new/lib/sshkit/version.rb --- old/lib/sshkit/version.rb 2016-09-16 22:45:29.000000000 +0200 +++ new/lib/sshkit/version.rb 2016-11-03 05:53:51.000000000 +0100 @@ -1,3 +1,3 @@ module SSHKit - VERSION = "1.11.3".freeze + VERSION = "1.11.4".freeze end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/metadata new/metadata --- old/metadata 2016-09-16 22:45:29.000000000 +0200 +++ new/metadata 2016-11-03 05:53:51.000000000 +0100 @@ -1,7 +1,7 @@ --- !ruby/object:Gem::Specification name: sshkit version: !ruby/object:Gem::Version - version: 1.11.3 + version: 1.11.4 platform: ruby authors: - Lee Hambley @@ -9,7 +9,7 @@ autorequire: bindir: bin cert_chain: [] -date: 2016-09-16 00:00:00.000000000 Z +date: 2016-11-03 00:00:00.000000000 Z dependencies: - !ruby/object:Gem::Dependency name: net-ssh @@ -219,7 +219,7 @@ version: '0' requirements: [] rubyforge_project: -rubygems_version: 2.6.6 +rubygems_version: 2.6.7 signing_key: specification_version: 4 summary: SSHKit makes it easy to write structured, testable SSH commands in Ruby diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/unit/test_command.rb new/test/unit/test_command.rb --- old/test/unit/test_command.rb 2016-09-16 22:45:29.000000000 +0200 +++ new/test/unit/test_command.rb 2016-11-03 05:53:51.000000000 +0100 @@ -49,6 +49,12 @@ assert_equal %{( export FOO="asdf\\\"hjkl" ; /usr/bin/env rails server )}, c.to_command end + def test_percentage_symbol_handled_in_env + SSHKit.config = nil + c = Command.new(:rails, 'server', env: {foo: 'asdf%hjkl'}, user: "anotheruser") + assert_equal %{( export FOO="asdf%hjkl" ; sudo -u anotheruser FOO=\"asdf%hjkl\" -- sh -c '/usr/bin/env rails server' )}, c.to_command + end + def test_including_the_env_doesnt_addressively_escape SSHKit.config = nil c = Command.new(:rails, 'server', env: {path: '/example:$PATH'})
