Project

General

Profile

Actions

Backport #5452

closed

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

Added by brixen (Brian Shirai) over 10 years ago. Updated over 5 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

Updated by nobu (Nobuyoshi Nakada) over 10 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) over 10 years ago

  • Status changed from Open to Rejected

Updated by nahi (Hiroshi Nakamura) over 10 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.

Actions #4

Updated by naruse (Yui NARUSE) over 10 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)
Actions #5

Updated by shyouhei (Shyouhei Urabe) over 5 years ago

  • Status changed from Assigned to Closed
Actions

Also available in: Atom PDF