Project

General

Profile

Feature #16495

Inconsistent quotes in error messages

Added by Kolano (Kenneth Kolano) 8 months ago. Updated about 1 month ago.

Status:
Open
Priority:
Normal
Target version:
-
[ruby-core:96742]

Description

Error messages use inconsistent pairs of quotes, for instance:

-e:1:in `<main>': undefined local variable or method `foo' for main:Object (NameError)

where a back tick is used on the left-hand side, and a single quote is used on the right.

The same quotes should be used on either side of the elements being quoted.


Related issues

Related to Ruby master - Bug #12321: Backticks in log output cause issuesRejectedActions
Related to Ruby master - Bug #13589: unmatched opening backtick / closing quote in NoMethodError: undefined method `name' for {}:HashRejectedActions
Is duplicate of Ruby master - Bug #17107: Backtick in backtrace is a little bit annoyingRejectedActions
#1

Updated by jeremyevans0 (Jeremy Evans) 8 months ago

  • Backport deleted (2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN)
  • ruby -v deleted (2.5.3)
  • Tracker changed from Bug to Feature

Updated by shevegen (Robert A. Heiler) 8 months ago

Hmm. Is this encoding-related perhaps? I remember having had that when I used ISO (ISO-8859-1 specifically, and
a non-utf locale too). Nowadays, with Unicode, I don't seem to have this inconsistent quote - but I understand
what you refer to. I used to think that it was used to denote the start, and end part of the content. :P
(They are not the same characters in general right? Otherwise they would appear the same. I always thought it
may be some standard, perhaps to make parsing easier or something.)

Never bothered me that much to really investigate, though.

Updated by nobu (Nobuyoshi Nakada) 8 months ago

This combination is very common, e.g., Emacs, TeX, etc.

#4

Updated by mame (Yusuke Endoh) 8 months ago

  • Related to Bug #12321: Backticks in log output cause issues added
#5

Updated by mame (Yusuke Endoh) 8 months ago

  • Related to Bug #13589: unmatched opening backtick / closing quote in NoMethodError: undefined method `name' for {}:Hash added
#6

Updated by sawa (Tsuyoshi Sawada) 8 months ago

  • Description updated (diff)
  • Subject changed from Inconsistant Quotes in Error Messages to Inconsistent quotes in error messages

Updated by matz (Yukihiro Matsumoto) 8 months ago

It was something cultural. I admit nowadays very few people use backquote as a left-hand quote, but it used to be. I also admit consistent quotes are easier for our eyes when using recent major fonts. But changing those quotes may affect existing log parsers. We have to estimate how big is the influence of the changes.

Matz.

Updated by Dan0042 (Daniel DeLorme) 8 months ago

Maybe a fix could involve customization of which quotes to display via an ENV var or something?
Instead of changing the code all over the place you'd just be changing e.g. rb_sprintf to replace matching sets of ` and ' to use the custom quotes.
So it would be possible to dynamically set the quotes to ' and ' (or even unicode ‘ and ’) if you don't use log parsers that rely on the regular behavior.
Log parsers could eventually use these custom quotes for their parsing.
It would be possible for individuals to gradually experiment and report bugs where custom quote are causing trouble.
Just an idea...

Updated by marcandre (Marc-Andre Lafortune) 8 months ago

  • Assignee set to matz (Yukihiro Matsumoto)

I fail to see the actual gain.

This would introducing potential incompatibilities. For example, I remember parsing using these quotes myself (this code isn't used for recent rubies so doing the change wouldn't actually affect it).

Please reject this.

Updated by zverok (Victor Shepelev) 8 months ago

I fail to see the actual gain.

As it was already pointed in related tickets, the gain (or rather the problem solved) comes when the error message is copy-pasted into any input field supporting Markdown or Markdown-alike syntax. This includes this very tracker; and GitHub/GitLab comments/PRs; and Slack and any of its open- or closed-source modern alternatives, like Gitter or Mattermost; and almost any other of developer-friendly software that emerged in the last 10 years or so. I believe it is relatively small, but constantly annoying problem.

Updated by nobu (Nobuyoshi Nakada) 8 months ago

zverok (Victor Shepelev) wrote:

I fail to see the actual gain.

As it was already pointed in related tickets, the gain (or rather the problem solved) comes when the error message is copy-pasted into any input field supporting Markdown or Markdown-alike syntax. This includes this very tracker; and GitHub/GitLab comments/PRs; and Slack and any of its open- or closed-source modern alternatives, like Gitter or Mattermost; and almost any other of developer-friendly software that emerged in the last 10 years or so. I believe it is relatively small, but constantly annoying problem.

Why don't you use block quoting?

Updated by zverok (Victor Shepelev) 8 months ago

nobu (Nobuyoshi Nakada)

Why don't you use block quoting?

Because error messages are by their nature something you frequently want to communicate quickly and inline?
Here are some examples of backtick breaking communication: https://gist.github.com/zverok/a4fcacab3dc06d9d7585c82cad8a8dc6

Updated by vlad0337187 (Vladislav Ivanov) about 1 month ago

Some terminals don't highlight text inside different quotes (for example, Iterm2, Terminal on Mac).
So you're going to double-click, copy; but have to highlight text manually.

#14

Updated by hsbt (Hiroshi SHIBATA) about 1 month ago

  • Is duplicate of Bug #17107: Backtick in backtrace is a little bit annoying added

Also available in: Atom PDF