Project

General

Profile

Backport #5452

String#squeeze[!] with negated out-of-order sequence behaves like no argument was passed

Added by brixen (Brian Shirai) almost 8 years ago. Updated over 2 years ago.

Status:
Closed
Priority:
Normal
[ruby-core:40163]

Description

See the examples below:

String#squeeze!

$ ruby -e 'p "-subbookkeeper-".squeeze!("b-e")'
"-subookkeper-"

$ ruby -e 'p "-subbookkeeper-".squeeze!("b-e")'
"-subbokeeper-"

$ ruby -e 'p "-subbookkeeper-".squeeze!("e-b")'
nil

$ ruby -e 'p "-subbookkeeper-".squeeze!("e-b")'
"-subokeper-"

^ This looks like a bug

$ ruby -e 'p "-subbookkeeper-".squeeze!'
"-subokeper-"

String#squeeze

$ ruby -e 'p "-subbookkeeper-".squeeze("e-b")'
"-subbookkeeper-"

$ ruby -e 'p "-subbookkeeper-".squeeze("e-b")'
"-subokeper-"

^ And so does this

$ ruby -e 'p "-subbookkeeper-".squeeze'
"-subokeper-"

Thanks,
Brian

History

Updated by nobu (Nobuyoshi Nakada) almost 8 years ago

=begin
It raises an exception in 1.9.

$ ruby -e 'p "-subbookkeeper-".squeeze("e-b")'
-e:1:in squeeze': invalid range "e-b" in string transliteration (ArgumentError)
from -e:1:in
'

And 1.8 has no future to introduce any behavior changes.
=end

Updated by nobu (Nobuyoshi Nakada) almost 8 years ago

  • Status changed from Open to Rejected

Updated by nahi (Hiroshi Nakamura) almost 8 years ago

  • Category set to core
  • Status changed from Rejected to Open
  • Assignee set to shyouhei (Shyouhei Urabe)
  • Target version set to Ruby 1.8.7

It's fixed by #1953 and r25576 by Matz.

I re-open this for making sure Shyouhei can decide whether it's backportable or not.

#4

Updated by naruse (Yui NARUSE) almost 8 years ago

  • Tracker changed from Bug to Backport
  • Project changed from Ruby 1.8 to Backport187
  • Category changed from core to core
  • Status changed from Open to Assigned
  • Target version deleted (Ruby 1.8.7)
#5

Updated by shyouhei (Shyouhei Urabe) over 2 years ago

  • Status changed from Assigned to Closed

Also available in: Atom PDF