[ruby-core:62670] [ruby-trunk - Bug #9849] gsub(String, String) doesn't work properly

From: nobu@...
Date: 2014-05-19 07:29:43 UTC
List: ruby-core #62670
Issue #9849 has been updated by Nobuyoshi Nakada.

Backport changed from 2.0.0: UNKNOWN, 2.1: UNKNOWN to 2.0.0: DONTNEED, 2.1: DONTNEED

----------------------------------------
Bug #9849: gsub(String, String) doesn't work properly
https://bugs.ruby-lang.org/issues/9849#change-46804

* Author: Shugo Maeda
* Status: Assigned
* Priority: Normal
* Assignee: Nobuyoshi Nakada
* Category: core
* Target version: current: 2.2.0
* ruby -v: ruby 2.2.0dev (2014-05-19 trunk 46010) [i686-linux]
* Backport: 2.0.0: DONTNEED, 2.1: DONTNEED
----------------------------------------
gsub(String, String) doesn't work properly as follows:

```
$ ruby -ve 'puts "あああ\"foo\"\n\"bar\"".gsub("\"", "\"\"")' 
ruby 2.2.0dev (2014-05-19 trunk 46010) [i686-linux]
あああ""foo"
"bar""
```

The expected behavior is:

```
$ ~/.rbenv/versions/2.1.1/bin/ruby -ve 'puts "あああ\"foo\"\n\"bar\"".gsub("\"", "\"\"")' 
ruby 2.1.1p76 (2014-02-24 revision 45161) [i686-linux]
あああ""foo""
""bar""
```

It seems that the bug was introduced by r45451, so I assign this issue to nobu.




-- 
https://bugs.ruby-lang.org/

In This Thread

Prev Next