Hello community,

here is the log from the commit of package rubygem-cheetah for openSUSE:Factory 
checked in at 2019-10-23 15:35:24
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/rubygem-cheetah (Old)
 and      /work/SRC/openSUSE:Factory/.rubygem-cheetah.new.2352 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "rubygem-cheetah"

Wed Oct 23 15:35:24 2019 rev:3 rq:739031 version:0.5.1

Changes:
--------
--- /work/SRC/openSUSE:Factory/rubygem-cheetah/rubygem-cheetah.changes  
2016-03-16 10:26:23.000000000 +0100
+++ 
/work/SRC/openSUSE:Factory/.rubygem-cheetah.new.2352/rubygem-cheetah.changes    
    2019-10-23 15:35:25.605652433 +0200
@@ -1,0 +2,14 @@
+Thu Oct 17 08:07:34 UTC 2019 - Josef Reidinger <[email protected]>
+
+- updated to version 0.5.1
+  see installed CHANGELOG
+
+  0.5.1 (2019-10-16)
+  ------------------
+
+  * Implement closing open fds after call to fork (bsc#1151960). This will work
+    only in linux system with mounted /proc. For other Unixes it works as 
before.
+  * drop support for ruby that is EOL (2.3 and lower)
+  * Added support for ruby 2.4, 2.5, 2.6
+
+-------------------------------------------------------------------

Old:
----
  cheetah-0.5.0.gem

New:
----
  cheetah-0.5.1.gem

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ rubygem-cheetah.spec ++++++
--- /var/tmp/diff_new_pack.KjgOo5/_old  2019-10-23 15:35:25.989652874 +0200
+++ /var/tmp/diff_new_pack.KjgOo5/_new  2019-10-23 15:35:25.993652878 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package rubygem-cheetah
 #
-# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -24,16 +24,16 @@
 #
 
 Name:           rubygem-cheetah
-Version:        0.5.0
+Version:        0.5.1
 Release:        0
 %define mod_name cheetah
 %define mod_full_name %{mod_name}-%{version}
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
-BuildRequires:  %{rubygem gem2rpm}
-BuildRequires:  %{ruby}
 BuildRequires:  ruby-macros >= 5
+BuildRequires:  %{ruby}
+BuildRequires:  %{rubygem gem2rpm}
 Url:            https://github.com/openSUSE/cheetah
-Source:         http://rubygems.org/gems/%{mod_full_name}.gem
+Source:         https://rubygems.org/gems/%{mod_full_name}.gem
 Source1:        gem2rpm.yml
 Summary:        Your swiss army knife for executing external commands in Ruby 
safely
 License:        MIT

++++++ cheetah-0.5.0.gem -> cheetah-0.5.1.gem ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/CHANGELOG new/CHANGELOG
--- old/CHANGELOG       2015-12-18 15:34:32.000000000 +0100
+++ new/CHANGELOG       2019-10-17 10:05:14.000000000 +0200
@@ -1,3 +1,11 @@
+0.5.1 (2019-10-16)
+------------------
+
+* Implement closing open fds after call to fork (bsc#1151960). This will work
+  only in linux system with mounted /proc. For other Unixes it works as before.
+* drop support for ruby that is EOL (2.3 and lower)
+* Added support for ruby 2.4, 2.5, 2.6
+
 0.5.0 (2015-12-18)
 ------------------
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/VERSION new/VERSION
--- old/VERSION 2015-12-18 15:34:32.000000000 +0100
+++ new/VERSION 2019-10-17 10:05:14.000000000 +0200
@@ -1 +1 @@
-0.5.0
+0.5.1
Binary files old/checksums.yaml.gz and new/checksums.yaml.gz differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/cheetah/version.rb new/lib/cheetah/version.rb
--- old/lib/cheetah/version.rb  2015-12-18 15:34:32.000000000 +0100
+++ new/lib/cheetah/version.rb  2019-10-17 10:05:14.000000000 +0200
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 # Cheetah namespace
 module Cheetah
   # Cheetah version (uses [semantic versioning](http://semver.org/)).
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/cheetah.rb new/lib/cheetah.rb
--- old/lib/cheetah.rb  2015-12-18 15:34:32.000000000 +0100
+++ new/lib/cheetah.rb  2019-10-17 10:05:14.000000000 +0200
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 require "abstract_method"
 require "logger"
 require "shellwords"
@@ -142,16 +144,16 @@
   class DefaultRecorder < Recorder
     # @private
     STREAM_INFO = {
-      stdin:  { name: "Standard input",  method: :info  },
+      stdin: { name: "Standard input", method: :info },
       stdout: { name: "Standard output", method: :info  },
       stderr: { name: "Error output",    method: :error }
-    }
+    }.freeze
 
     def initialize(logger)
       @logger = logger
 
       @stream_used   = { stdin: false, stdout: false, stderr: false }
-      @stream_buffer = { stdin: "",    stdout: "",    stderr: "" }
+      @stream_buffer = { stdin: +"", stdout: +"", stderr: +"" }
     end
 
     def record_commands(commands)
@@ -212,13 +214,13 @@
 
   # @private
   BUILTIN_DEFAULT_OPTIONS = {
-    stdin:  "",
+    stdin: "",
     stdout: nil,
     stderr: nil,
     logger: nil,
-    env:    {},
+    env: {},
     chroot: "/"
-  }
+  }.freeze
 
   READ  = 0 # @private
   WRITE = 1 # @private
@@ -426,7 +428,7 @@
       # and nil is an IO-like object. We avoid detecting it directly to allow
       # passing StringIO, mocks, etc.
       {
-        stdin:  !options[:stdin].is_a?(String),
+        stdin: !options[:stdin].is_a?(String),
         stdout: ![nil, :capture].include?(options[:stdout]),
         stderr: ![nil, :capture].include?(options[:stderr])
       }
@@ -434,9 +436,9 @@
 
     def build_streams(options, streamed)
       {
-        stdin:  streamed[:stdin] ? options[:stdin] : 
StringIO.new(options[:stdin]),
-        stdout: streamed[:stdout] ? options[:stdout] : StringIO.new(""),
-        stderr: streamed[:stderr] ? options[:stderr] : StringIO.new("")
+        stdin: streamed[:stdin] ? options[:stdin] : 
StringIO.new(options[:stdin]),
+        stdout: streamed[:stdout] ? options[:stdout] : StringIO.new(+""),
+        stderr: streamed[:stderr] ? options[:stderr] : StringIO.new(+"")
       }
     end
 
@@ -494,7 +496,7 @@
       return options if [nil, "/"].include?(options[:chroot])
 
       options = options.dup
-      # delete chroot option otherwise in pipe will chroot each fork 
recursivelly
+      # delete chroot option otherwise in pipe will chroot each fork 
recursively
       root = options.delete(:chroot)
       Dir.chroot(root)
       # curdir can be outside chroot which is considered as security problem
@@ -520,8 +522,7 @@
                                       stdout: pipe_to_child,
                                       stderr: pipes[:stderr]
                                     },
-                                    options
-                                   )
+                                    options)
 
             pipes[:stdin][READ].close
             pipes[:stdin][WRITE].close
@@ -532,9 +533,7 @@
           into_pipe(STDOUT, pipes[:stdout])
           into_pipe(STDERR, pipes[:stderr])
 
-          # All file descriptors from 3 above should be closed here, but since 
I
-          # don't know about any way how to detect the maximum file descriptor
-          # number portably in Ruby, I didn't implement it. Patches welcome.
+          close_fds
 
           command, *args = commands.last
           with_env(options[:env]) do
@@ -550,6 +549,27 @@
       end
     end
 
+    # closes all open fds starting with 3 and above
+    def close_fds
+      # note: this will work only if unix has /proc filesystem. If it does not
+      # have it, it won't close other fds.
+      Dir.glob("/proc/self/fd/*").each do |path|
+        fd = File.basename(path).to_i
+        next if (0..2).include?(fd)
+
+        # here we intentionally ignore some failures when fd close failed
+        # rubocop:disable Lint/HandleExceptions
+        begin
+          IO.new(fd).close
+        # Ruby reserves some fds for its VM and it result in this exception
+        rescue ArgumentError
+        # Ignore if close failed with invalid FD
+        rescue Errno::EBADF
+        end
+        # rubocop:enable Lint/HandleExceptions
+      end
+    end
+
     def fork_commands(commands, options)
       pipes = { stdin: IO.pipe, stdout: IO.pipe, stderr: IO.pipe }
 
@@ -595,9 +615,7 @@
         ios_read, ios_write, ios_error = select(pipes_readable, pipes_writable,
                                                 pipes_readable + 
pipes_writable)
 
-        if !ios_error.empty?
-          raise IOError, "Error when communicating with executed program."
-        end
+        raise IOError, "Error when communicating with executed program." if 
!ios_error.empty?
 
         ios_read.each do |pipe|
           begin
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/metadata new/metadata
--- old/metadata        2015-12-18 15:34:38.000000000 +0100
+++ new/metadata        2019-10-17 10:05:14.000000000 +0200
@@ -1,14 +1,14 @@
 --- !ruby/object:Gem::Specification
 name: cheetah
 version: !ruby/object:Gem::Version
-  version: 0.5.0
+  version: 0.5.1
 platform: ruby
 authors:
 - David Majda
 autorequire: 
 bindir: bin
 cert_chain: []
-date: 2015-12-18 00:00:00.000000000 Z
+date: 2019-10-17 00:00:00.000000000 Z
 dependencies:
 - !ruby/object:Gem::Dependency
   name: abstract_method
@@ -42,16 +42,16 @@
   name: yard
   requirement: !ruby/object:Gem::Requirement
     requirements:
-    - - "~>"
+    - - ">="
       - !ruby/object:Gem::Version
-        version: '0'
+        version: 0.9.11
   type: :development
   prerelease: false
   version_requirements: !ruby/object:Gem::Requirement
     requirements:
-    - - "~>"
+    - - ">="
       - !ruby/object:Gem::Version
-        version: '0'
+        version: 0.9.11
 description: Your swiss army knife for executing external commands in Ruby 
safely
   and conveniently.
 email: [email protected]
@@ -84,11 +84,9 @@
     - !ruby/object:Gem::Version
       version: '0'
 requirements: []
-rubyforge_project: 
-rubygems_version: 2.4.5.1
+rubygems_version: 3.0.3
 signing_key: 
 specification_version: 4
 summary: Your swiss army knife for executing external commands in Ruby safely 
and
   conveniently.
 test_files: []
-has_rdoc: 


Reply via email to