From 506c7e13cff6f8715385fa8488b621028b4ad280 Mon Sep 17 00:00:00 2001 From: Ryan Davis Date: Fri, 8 Mar 2013 15:37:23 -0800 Subject: [PATCH] + OMG A SECURITY ISSUE FOR CODE NOBODY USES... EVER [git-p4: depot-paths = "//src/ruby_parser/dev/": change = 8297] --- lib/gauntlet_rubyparser.rb | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/lib/gauntlet_rubyparser.rb b/lib/gauntlet_rubyparser.rb index 4463c38e..77542dd9 100755 --- a/lib/gauntlet_rubyparser.rb +++ b/lib/gauntlet_rubyparser.rb @@ -35,18 +35,15 @@ def should_skip? name def diff_pp o1, o2 require 'pp' - File.open("/tmp/a.#{$$}", "w") do |f| - PP.pp o1, f - end + Tempfile.new('ruby_parser_a') do |file_a| + PP.pp o1, file_a - File.open("/tmp/b.#{$$}", "w") do |f| - PP.pp o2, f - end + Tempfile.new('ruby_parser_b') do |file_b| + PP.pp o2, file_b - `diff -u /tmp/a.#{$$} /tmp/b.#{$$}` - ensure - File.unlink "/tmp/a.#{$$}" rescue nil - File.unlink "/tmp/b.#{$$}" rescue nil + `diff -u #{file_a.path} #{file_b.path}` + end + end end def broke name, file, msg