[前][次][番号順一覧][スレッド一覧]

ruby-changes:33397

From: nagachika <ko1@a...>
Date: Mon, 31 Mar 2014 01:01:39 +0900 (JST)
Subject: [ruby-changes:33397] nagachika:r45476 (ruby_2_0_0): merge revision(s) r45374: [Backport #8405]

nagachika	2014-03-31 01:01:31 +0900 (Mon, 31 Mar 2014)

  New Revision: 45476

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=45476

  Log:
    merge revision(s) r45374: [Backport #8405]
    
    * lib/csv.rb: Fixed a broken regular expression that was causing
      CSV to miss escaping some special meaning characters when used
      in parsing.
      Reported by David Unric
      [ruby-core:54986] [Bug #8405]

  Modified directories:
    branches/ruby_2_0_0/
  Modified files:
    branches/ruby_2_0_0/ChangeLog
    branches/ruby_2_0_0/lib/csv.rb
    branches/ruby_2_0_0/test/csv/test_features.rb
    branches/ruby_2_0_0/version.h
Index: ruby_2_0_0/ChangeLog
===================================================================
--- ruby_2_0_0/ChangeLog	(revision 45475)
+++ ruby_2_0_0/ChangeLog	(revision 45476)
@@ -1,3 +1,11 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/ChangeLog#L1
+Mon Mar 31 00:57:39 2014  James Edward Gray II  <james@g...>
+
+	* lib/csv.rb: Fixed a broken regular expression that was causing
+	  CSV to miss escaping some special meaning characters when used
+	  in parsing.
+	  Reported by David Unric
+	  [ruby-core:54986] [Bug #8405]
+
 Mon Mar 31 00:48:12 2014  CHIKANAGA Tomoyuki  <nagachika@r...>
 
 	* test/ruby/envutil.rb (assert_no_memory_leak): increase default value
Index: ruby_2_0_0/lib/csv.rb
===================================================================
--- ruby_2_0_0/lib/csv.rb	(revision 45475)
+++ ruby_2_0_0/lib/csv.rb	(revision 45476)
@@ -1504,8 +1504,7 @@ class CSV https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/lib/csv.rb#L1504
     # if we can transcode the needed characters
     #
     @re_esc   =   "\\".encode(@encoding) rescue ""
-    @re_chars =   /#{%"[-][\\.^$?*+{}()|# \r\n\t\f\v]".encode(@encoding)}/
-    # @re_chars =   /#{%"[-][\\.^$?*+{}()|# \r\n\t\f\v]".encode(@encoding, fallback: proc{""})}/
+    @re_chars =   /#{%"[-\\]\\[\\.^$?*+{}()|# \r\n\t\f\v]".encode(@encoding)}/
 
     init_separators(options)
     init_parsers(options)
Index: ruby_2_0_0/version.h
===================================================================
--- ruby_2_0_0/version.h	(revision 45475)
+++ ruby_2_0_0/version.h	(revision 45476)
@@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/version.h#L1
 #define RUBY_VERSION "2.0.0"
 #define RUBY_RELEASE_DATE "2014-03-31"
-#define RUBY_PATCHLEVEL 465
+#define RUBY_PATCHLEVEL 466
 
 #define RUBY_RELEASE_YEAR 2014
 #define RUBY_RELEASE_MONTH 3
Index: ruby_2_0_0/test/csv/test_features.rb
===================================================================
--- ruby_2_0_0/test/csv/test_features.rb	(revision 45475)
+++ ruby_2_0_0/test/csv/test_features.rb	(revision 45476)
@@ -74,6 +74,14 @@ class TestCSV::Features < TestCSV https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/test/csv/test_features.rb#L74
     end
   end
 
+  def test_bug_8405
+    TEST_CASES.each do |test_case|
+      assert_equal( test_case.last.map { |t| t.tr('"', "|") unless t.nil? },
+                    CSV.parse_line( test_case.first.tr('"', "|"),
+                                    quote_char: "|" ) )
+    end
+  end
+
   def test_csv_char_readers
     %w[col_sep row_sep quote_char].each do |reader|
       csv = CSV.new("abc,def", reader.to_sym => "|")

Property changes on: ruby_2_0_0
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r45374


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]