Project

General

Profile

Actions

Bug #17107

closed

Backtick in backtrace is a little bit annoying

Added by ioquatix (Samuel Williams) about 4 years ago. Updated about 4 years ago.

Status:
Rejected
Assignee:
-
Target version:
-
[ruby-core:99513]

Description

In Ruby exception backtrace (and other places), the method name uses a quoting style of a backtick followed by a text/name followed by an apostrophy.

in `<main>'

The quoting style is not safe, as in, it cannot be relied upon for parsing, because it's easy to inject quotes into the output stream:

e.g.

irb(main):006:0> self.send(:"I'm Great")
Traceback (most recent call last):
        4: from /tmp/64556713-b3a1-40a1-b458-bfed3fec55b2:8:in `<main>'
        3: from <internal:prelude>:20:in `irb'
        2: from /tmp/64556713-b3a1-40a1-b458-bfed3fec55b2:5:in `<main>'
        1: from /tmp/64556713-b3a1-40a1-b458-bfed3fec55b2:6:in `rescue in <main>'
NoMethodError (undefined method `I'm Great' for main:Object)

Note the last line now has ambiguous quoting.

  • Should we fix this quoting style?
  • Should we remove this quoting style?
  • Should we choose some other quoting style?

As a specific point:

  • Can we use two apostrophes rather than a backtick/apostrophe? Backticks often have a special meaning (e.g. markdown) which makes it somewhat annoying to copy and paste.

Related issues 2 (0 open2 closed)

Is duplicate of Ruby master - Bug #13589: unmatched opening backtick / closing quote in NoMethodError: undefined method `name' for {}:HashRejectedActions
Has duplicate Ruby master - Feature #16495: Inconsistent quotes in error messagesClosedmatz (Yukihiro Matsumoto)Actions
Actions #1

Updated by hsbt (Hiroshi SHIBATA) about 4 years ago

  • Is duplicate of Bug #13589: unmatched opening backtick / closing quote in NoMethodError: undefined method `name' for {}:Hash added

Updated by hsbt (Hiroshi SHIBATA) about 4 years ago

  • Status changed from Open to Rejected

See #13589

Updated by sawa (Tsuyoshi Sawada) about 4 years ago

The choice of characters used for quoting is irrelevant to such problem, which will not be solved unless the method name is represented escaped such as in string inspection form.

I do not think it is right to parse the error message. If you want access to the method name, you should use NoMethodError#name.

Actions #4

Updated by hsbt (Hiroshi SHIBATA) about 4 years ago

  • Has duplicate Feature #16495: Inconsistent quotes in error messages added
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0