ruby-changes:58673
From: Kazuhiro <ko1@a...>
Date: Sat, 9 Nov 2019 16:45:55 +0900 (JST)
Subject: [ruby-changes:58673] 352096ef60 (master): Add debug print
https://git.ruby-lang.org/ruby.git/commit/?id=352096ef60 From 352096ef6047538bfedb974a7c1b1156f5a0e811 Mon Sep 17 00:00:00 2001 From: Kazuhiro NISHIYAMA <zn@m...> Date: Sat, 9 Nov 2019 16:43:47 +0900 Subject: Add debug print diff --git a/spec/ruby/security/cve_2018_6914_spec.rb b/spec/ruby/security/cve_2018_6914_spec.rb index 3cebff2..a478ac8 100644 --- a/spec/ruby/security/cve_2018_6914_spec.rb +++ b/spec/ruby/security/cve_2018_6914_spec.rb @@ -17,6 +17,18 @@ describe "CVE-2018-6914 is resisted by" do https://github.com/ruby/ruby/blob/trunk/spec/ruby/security/cve_2018_6914_spec.rb#L17 sleep 0.1 end + @debug_print = ->(actual) { + STDERR.puts({ + actual: actual, + absolute: File.absolute_path(actual), + dir: @dir, + pwd: Dir.pwd, + tmpdir: @tmpdir, + Dir_tmpdir: Dir.tmpdir, + TMPDIR: ENV['TMPDIR'], + }) + } + @dir << '/' @tempfile = nil @@ -31,12 +43,14 @@ describe "CVE-2018-6914 is resisted by" do https://github.com/ruby/ruby/blob/trunk/spec/ruby/security/cve_2018_6914_spec.rb#L43 it "Tempfile.open by deleting separators" do @tempfile = Tempfile.open(['../', 'foo']) actual = @tempfile.path + @debug_print.call(actual) File.absolute_path(actual).should.start_with?(@dir) end it "Tempfile.new by deleting separators" do @tempfile = Tempfile.new('../foo') actual = @tempfile.path + @debug_print.call(actual) File.absolute_path(actual).should.start_with?(@dir) end @@ -44,6 +58,7 @@ describe "CVE-2018-6914 is resisted by" do https://github.com/ruby/ruby/blob/trunk/spec/ruby/security/cve_2018_6914_spec.rb#L58 actual = Tempfile.create('../foo') do |t| t.path end + @debug_print.call(actual) File.absolute_path(actual).should.start_with?(@dir) end @@ -51,6 +66,7 @@ describe "CVE-2018-6914 is resisted by" do https://github.com/ruby/ruby/blob/trunk/spec/ruby/security/cve_2018_6914_spec.rb#L66 actual = Dir.mktmpdir('../foo') do |path| path end + @debug_print.call(actual) File.absolute_path(actual).should.start_with?(@dir) end @@ -58,6 +74,7 @@ describe "CVE-2018-6914 is resisted by" do https://github.com/ruby/ruby/blob/trunk/spec/ruby/security/cve_2018_6914_spec.rb#L74 actual = Dir.mktmpdir(['../', 'foo']) do |path| path end + @debug_print.call(actual) File.absolute_path(actual).should.start_with?(@dir) end end -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/