Project

General

Profile

Actions

Backport #4986

closed

Parsing bug in irb: "#{"//"}"

Added by listrophy (Brad Grzesiak) over 12 years ago. Updated over 4 years ago.

Status:
Closed
Assignee:
-
[ruby-core:37842]

Description

When issuing the following command in irb, it believes it's in the middle of a regexp, rather than returning a string with two slashes:

"#{"//"}"

While this doesn't seem all that common, it has the same problem with the following string:

"#{Time.now.strftime("%m/%d/%Y")}"

irb version is: irb 0.9.5(05/04/13)

Updated by aprescott (Adam Prescott) over 12 years ago

On Thu, Jul 7, 2011 at 6:03 AM, Brad Grzesiak wrote:

When issuing the following command in irb, it believes it's in the middle of a regexp, rather than returning a string with two slashes:

   "#{"//"}"

While this doesn't seem all that common, it has the same problem with the following string:

   "#{Time.now.strftime("%m/%d/%Y")}"

irb version is: irb 0.9.5(05/04/13)

Works fine for me on a later version of IRB.

ruby-1.9.2-p180 :001 > IRB.version
=> "irb 0.9.6(09/06/30)"
ruby-1.9.2-p180 :002 > "#{"//"}"
=> "//"
ruby-1.9.2-p180 :003 > "#{Time.now.strftime("%m/%d/%Y")}"
=> "07/07/2011"

Updated by listrophy (Brad Grzesiak) over 12 years ago

Adam Prescott wrote:

On Thu, Jul 7, 2011 at 6:03 AM, Brad Grzesiak wrote:

When issuing the following command in irb, it believes it's in the middle of a regexp, rather than returning a string with two slashes:

   "#{"//"}"

While this doesn't seem all that common, it has the same problem with the following string:

   "#{Time.now.strftime("%m/%d/%Y")}"

irb version is: irb 0.9.5(05/04/13)

Works fine for me on a later version of IRB.

ruby-1.9.2-p180 :001 > IRB.version
=> "irb 0.9.6(09/06/30)"
ruby-1.9.2-p180 :002 > "#{"//"}"
=> "//"
ruby-1.9.2-p180 :003 > "#{Time.now.strftime("%m/%d/%Y")}"
=> "07/07/2011"

I've confirmed that the bug does not exist on ruby 1.9.2. The bug only manifests on ruby 1.8.7. I've seen it occur on both -p334 and -p352 (and, incidentally, ree-1.8.7-2010.02).

Actions #3

Updated by jeremyevans0 (Jeremy Evans) over 4 years ago

  • Tracker changed from Bug to Backport
  • Project changed from Ruby 1.8 to Backport187
  • Status changed from Open to Closed
  • ruby -v deleted (ruby 1.8.7 (2011-06-30 patchlevel 352) [x86_64-darwin10.8.0])
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0