Project

General

Profile

Bug #4986

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

Added by listrophy (Brad Grzesiak) almost 8 years ago. Updated almost 8 years ago.

Status:
Open
Priority:
Normal
Assignee:
-
Target version:
-
ruby -v:
ruby 1.8.7 (2011-06-30 patchlevel 352) [x86_64-darwin10.8.0]
[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)

History

Updated by aprescott (Adam Prescott) almost 8 years ago

On Thu, Jul 7, 2011 at 6:03 AM, Brad Grzesiak brad@bendyworks.com 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) almost 8 years ago

Adam Prescott wrote:

On Thu, Jul 7, 2011 at 6:03 AM, Brad Grzesiak brad@bendyworks.com 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).

Also available in: Atom PDF