8000 merge revision(s) r45374: [Backport #8405] · github/ruby@75edd5f · GitHub
[go: up one dir, main page]

Skip to content

Commit 75edd5f

Browse files
committed
merge revision(s) r45374: [Backport ruby#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 ruby#8405] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@45956 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
1 parent eff0f73 commit 75edd5f

File tree

4 files changed

+18
-3
lines changed

4 files changed

+18
-3
lines changed

ChangeLog

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
Fri May 16 00:27:02 2014 James Edward Gray II <james@graysoftinc.com>
2+
3+
* lib/csv.rb: Fixed a broken regular expression that was causing
4+
CSV to miss escaping some special meaning characters when used
5+
in parsing.
6+
Reported by David Unric
7+
[ruby-core:54986] [Bug #8405]
8+
19
Fri May 16 00:14:25 2014 Kohei Suzuki <eagletmt@gmail.com>
210

311
* vm_method.c (rb_method_entry_get_without_cache): me->klass is 0

lib/csv.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1507,8 +1507,7 @@ def initialize(data, options = Hash.new)
15071507
# if we can transcode the needed characters
15081508
#
15091509
@re_esc = "\\".encode(@encoding) rescue ""
1510-
@re_chars = /#{%"[-][\\.^$?*+{}()|# \r\n\t\f\v]".encode(@encoding)}/
1511-
# @re_chars = /#{%"[-][\\.^$?*+{}()|# \r\n\t\f\v]".encode(@encoding, fallback: proc{""})}/
1510+
@re_chars = /#{%"[-\\]\\[\\.^$?*+{}()|# \r\n\t\f\v]".encode(@encoding)}/
15121511

15131512
init_separators(options)
15141513
init_parsers(options)

test/csv/test_features.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,14 @@ def test_quote_char
7474
end
7575
end
7676

77+
def test_bug_8405
78+
TEST_CASES.each do |test_case|
79+
assert_equal( test_case.last.map { |t| t.tr('"', "|") unless t.nil? },
80+
CSV.parse_line( test_case.first.tr('"', "|"),
81+
quote_char: "|" ) )
82+
end
83+
end
84+
7785
def test_csv_char_readers
7886
%w[col_sep row_sep quote_char].each do |reader|
7987
csv = CSV.new("abc,def", reader.to_sym => "|")

version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#define RUBY_VERSION "2.1.2"
22
#define RUBY_RELEASE_DATE "2014-05-16"
3-
#define RUBY_PATCHLEVEL 101
3+
#define RUBY_PATCHLEVEL 102
44

55
#define RUBY_RELEASE_YEAR 2014
66
#define RUBY_RELEASE_MONTH 5

0 commit comments

Comments
 (0)
0