Hello community,
here is the log from the commit of package rubygem-mixlib-shellout for
openSUSE:Factory checked in at 2015-05-19 23:48:29
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/rubygem-mixlib-shellout (Old)
and /work/SRC/openSUSE:Factory/.rubygem-mixlib-shellout.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "rubygem-mixlib-shellout"
Changes:
--------
---
/work/SRC/openSUSE:Factory/rubygem-mixlib-shellout/rubygem-mixlib-shellout.changes
2015-02-11 16:46:11.000000000 +0100
+++
/work/SRC/openSUSE:Factory/.rubygem-mixlib-shellout.new/rubygem-mixlib-shellout.changes
2015-05-19 23:48:31.000000000 +0200
@@ -1,0 +2,6 @@
+Tue May 19 04:29:15 UTC 2015 - [email protected]
+
+- updated to version 2.1.0
+ no changelog found
+
+-------------------------------------------------------------------
Old:
----
mixlib-shellout-2.0.1.gem
New:
----
mixlib-shellout-2.1.0.gem
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ rubygem-mixlib-shellout.spec ++++++
--- /var/tmp/diff_new_pack.SCSHRi/_old 2015-05-19 23:48:32.000000000 +0200
+++ /var/tmp/diff_new_pack.SCSHRi/_new 2015-05-19 23:48:32.000000000 +0200
@@ -24,7 +24,7 @@
#
Name: rubygem-mixlib-shellout
-Version: 2.0.1
+Version: 2.1.0
Release: 0
%define mod_name mixlib-shellout
%define mod_full_name %{mod_name}-%{version}
++++++ mixlib-shellout-2.0.1.gem -> mixlib-shellout-2.1.0.gem ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/README.md new/README.md
--- old/README.md 2014-12-19 19:44:46.000000000 +0100
+++ new/README.md 2015-05-18 18:44:05.000000000 +0200
@@ -39,7 +39,7 @@
## Windows Impersonation Example
Invoke "whoami.exe" to demonstrate running a command as another user:
- whomai = Mixlib::ShellOut.new("whoami.exe", :user => "username", :domain
=> "DOMAIN", :password => "password")
+ whoami = Mixlib::ShellOut.new("whoami.exe", :user => "username", :domain
=> "DOMAIN", :password => "password")
whoami.run_command
## Platform Support
Files old/checksums.yaml.gz and new/checksums.yaml.gz differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/mixlib/shellout/unix.rb
new/lib/mixlib/shellout/unix.rb
--- old/lib/mixlib/shellout/unix.rb 2014-12-19 19:44:46.000000000 +0100
+++ new/lib/mixlib/shellout/unix.rb 2015-05-18 18:44:05.000000000 +0200
@@ -30,6 +30,47 @@
# No options to validate, raise exceptions here if needed
end
+ # Whether we're simulating a login shell
+ def using_login?
+ return login && user
+ end
+
+ # Helper method for sgids
+ def all_seconderies
+ ret = []
+ Etc.endgrent
+ while ( g = Etc.getgrent ) do
+ ret << g
+ end
+ Etc.endgrent
+ return ret
+ end
+
+ # The secondary groups that the subprocess will switch to.
+ # Currently valid only if login is used, and is set
+ # to the user's secondary groups
+ def sgids
+ return nil unless using_login?
+ user_name = Etc.getpwuid(uid).name
+ all_seconderies.select{|g| g.mem.include?(user_name)}.map{|g|g.gid}
+ end
+
+ # The environment variables that are deduced from simulating logon
+ # Only valid if login is used
+ def logon_environment
+ return {} unless using_login?
+ entry = Etc.getpwuid(uid)
+ # According to `man su`, the set fields are:
+ # $HOME, $SHELL, $USER, $LOGNAME, $PATH, and $IFS
+ # Values are copied from "shadow" package in Ubuntu 14.10
+ {'HOME'=>entry.dir, 'SHELL'=>entry.shell, 'USER'=>entry.name,
'LOGNAME'=>entry.name, 'PATH'=>'/sbin:/bin:/usr/sbin:/usr/bin', 'IFS'=>"\t\n"}
+ end
+
+ # Merges the two environments for the process
+ def process_environment
+ logon_environment.merge(self.environment)
+ end
+
# Run the command, writing the command's standard out and standard error
# to +stdout+ and +stderr+, and saving its exit status object to +status+
# === Returns
@@ -63,8 +104,8 @@
# CHEF-3390: Marshall.load on Ruby < 1.8.7p369 also has a GC bug
related
# to Marshall.load, so try disabling GC first.
propagate_pre_exec_failure
- get_child_pgid
+ @status = nil
@result = nil
@execution_time = 0
@@ -107,18 +148,6 @@
private
- def get_child_pgid
- # The behavior of Process.getpgid (see also getpgid(2) ) when the
- # argument is the pid of a zombie isn't well specified. On Linux it
- # works, on OS X it returns ESRCH (which ruby turns into Errno::ESRCH).
- #
- # If the child dies very quickly, @child_pid may be a zombie, so handle
- # ESRCH here.
- @child_pgid = -Process.getpgid(@child_pid)
- rescue Errno::ESRCH, Errno::EPERM
- @child_pgid = nil
- end
-
def set_user
if user
Process.uid = uid
@@ -133,8 +162,15 @@
end
end
+ def set_secondarygroups
+ if sgids
+ Process.groups = sgids
+ end
+ end
+
def set_environment
- environment.each do |env_var,value|
+ # user-set variables should override the login ones
+ process_environment.each do |env_var,value|
ENV[env_var] = value
end
end
@@ -147,14 +183,10 @@
Dir.chdir(cwd) if cwd
end
- # Process group id of the child. Returned as a negative value so you can
- # put it directly in arguments to kill, wait, etc.
- #
- # This may be nil if the child dies before the parent can query the
- # system for its pgid (on some systems it is an error to get the pgid of
- # a zombie).
+ # Since we call setsid the child_pgid will be the child_pid, set to
negative here
+ # so it can be directly used in arguments to kill, wait, etc.
def child_pgid
- @child_pgid
+ -@child_pid
end
def initialize_ipc
@@ -288,13 +320,14 @@
# support the "ONESHOT" optimization (where sh -c does exec without
# forking). To support cleaning up all the children, we need to
# ensure they're in a unique process group.
- # We cannot use setsid here since getpgid fails on AIX with EPERM
- # when parent and child have different sessions and the parent tries
to get the process group,
- # hence we just create a new process group, and have the same
session.
- Process.setpgrp
+ #
+ # We use setsid here to abandon our controlling tty and get a new
session
+ # and process group that are set to the pid of the child process.
+ Process.setsid
configure_subprocess_file_descriptors
+ set_secondarygroups
set_group
set_user
set_environment
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/mixlib/shellout/version.rb
new/lib/mixlib/shellout/version.rb
--- old/lib/mixlib/shellout/version.rb 2014-12-19 19:44:46.000000000 +0100
+++ new/lib/mixlib/shellout/version.rb 2015-05-18 18:44:05.000000000 +0200
@@ -1,5 +1,5 @@
module Mixlib
class ShellOut
- VERSION = "2.0.1"
+ VERSION = "2.1.0"
end
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/mixlib/shellout.rb new/lib/mixlib/shellout.rb
--- old/lib/mixlib/shellout.rb 2014-12-19 19:44:46.000000000 +0100
+++ new/lib/mixlib/shellout.rb 2015-05-18 18:44:05.000000000 +0200
@@ -40,8 +40,13 @@
attr_accessor :user
attr_accessor :domain
attr_accessor :password
+ # TODO remove
attr_accessor :with_logon
+ # Whether to simulate logon as the user. Normally set via options passed
to new
+ # Always enabled on windows
+ attr_accessor :login
+
# Group the command will run as. Normally set via options passed to new
attr_accessor :group
@@ -141,6 +146,8 @@
# child process. Generally this is used to copy data from the child to
# the parent's stdout so that users may observe the progress of
# long-running commands.
+ # * +login+: Whether to simulate a login (set secondary groups, primary
group, environment
+ # variables etc) as done by the OS in an actual login
# === Examples:
# Invoke find(1) to search for .rb files:
# find = Mixlib::ShellOut.new("find . -name '*.rb'")
@@ -164,6 +171,7 @@
@cwd = nil
@valid_exit_codes = [0]
@terminate_reason = nil
+ @timeout = nil
if command_args.last.is_a?(Hash)
parse_options(command_args.pop)
@@ -192,6 +200,7 @@
# The uid that the subprocess will switch to. If the user attribute was
# given as a username, it is converted to a uid by Etc.getpwnam
+ # TODO migrate to shellout/unix.rb
def uid
return nil unless user
user.kind_of?(Integer) ? user : Etc.getpwnam(user.to_s).uid
@@ -199,9 +208,11 @@
# The gid that the subprocess will switch to. If the group attribute is
# given as a group name, it is converted to a gid by Etc.getgrnam
+ # TODO migrate to shellout/unix.rb
def gid
- return nil unless group
- group.kind_of?(Integer) ? group : Etc.getgrnam(group.to_s).gid
+ return group.kind_of?(Integer) ? group : Etc.getgrnam(group.to_s).gid if
group
+ return Etc.getpwuid(uid).gid if using_login?
+ return nil
end
def timeout
@@ -322,7 +333,8 @@
self.log_tag = setting
when 'environment', 'env'
self.environment = setting || {}
-
+ when 'login'
+ self.login = setting
else
raise InvalidCommandOption, "option '#{option.inspect}' is not a
valid option for #{self.class.name}"
end
@@ -332,6 +344,9 @@
end
def validate_options(opts)
+ if login && !user
+ raise InvalidCommandOption, "cannot set login without specifying a
user"
+ end
super
end
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/metadata new/metadata
--- old/metadata 2014-12-19 19:44:46.000000000 +0100
+++ new/metadata 2015-05-18 18:44:05.000000000 +0200
@@ -1,29 +1,29 @@
--- !ruby/object:Gem::Specification
name: mixlib-shellout
version: !ruby/object:Gem::Version
- version: 2.0.1
+ version: 2.1.0
platform: ruby
authors:
- Opscode
autorequire:
bindir: bin
cert_chain: []
-date: 2014-12-19 00:00:00.000000000 Z
+date: 2015-05-18 00:00:00.000000000 Z
dependencies:
- !ruby/object:Gem::Dependency
name: rspec
requirement: !ruby/object:Gem::Requirement
requirements:
- - - ~>
+ - - "~>"
- !ruby/object:Gem::Version
- version: '2.0'
+ version: '3.0'
type: :development
prerelease: false
version_requirements: !ruby/object:Gem::Requirement
requirements:
- - - ~>
+ - - "~>"
- !ruby/object:Gem::Version
- version: '2.0'
+ version: '3.0'
description: Run external commands on Unix or Windows
email: [email protected]
executables: []
@@ -49,17 +49,17 @@
- lib
required_ruby_version: !ruby/object:Gem::Requirement
requirements:
- - - ! '>='
+ - - ">="
- !ruby/object:Gem::Version
version: 1.9.3
required_rubygems_version: !ruby/object:Gem::Requirement
requirements:
- - - ! '>='
+ - - ">="
- !ruby/object:Gem::Version
version: '0'
requirements: []
rubyforge_project:
-rubygems_version: 2.4.1
+rubygems_version: 2.4.6
signing_key:
specification_version: 4
summary: Run external commands on Unix or Windows