After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 749008 - Wrong Hyperlink representation in man page
Wrong Hyperlink representation in man page
Status: RESOLVED FIXED
Product: gnome-terminal
Classification: Core
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: GNOME Terminal Maintainers
GNOME Terminal Maintainers
Depends on:
Blocks:
 
 
Reported: 2015-05-06 10:57 UTC by Vít Ondruch
Modified: 2016-02-21 14:52 UTC
See Also:
GNOME target: ---
GNOME version: 3.13/3.14



Description Vít Ondruch 2015-05-06 10:57:51 UTC
It seems that gnome-terminal does not handle escape sequences correctly. These are steps to reproduce

curl -O https://raw.githubusercontent.com/ruby/ruby/trunk/man/ruby.1
groff -mdoc -Tutf8 ruby.1 > ruby.out
cat ruby.out

You can see that the link is translated into:

⟨ESC[4mhttps://bugs.ruby-lang.org/projects/ruby/wiki/ContributorsESC[24m⟩

where the escape is not handled correctly for some reason.

BTW if you'd like to see this fixed in gnome-terminal, I'd suggest you to report this issue gnome upstream, since I'm afraid it might get lost in Fedora's Bugzilla.


This was originally reported as [1].


[1] https://bugzilla.redhat.com/show_bug.cgi?id=1218871
Comment 1 Vít Ondruch 2015-05-06 10:58:34 UTC
$ rpm -q gnome-terminal 
gnome-terminal-3.14.3-1.fc21.x86_64
Comment 2 Egmont Koblinger 2015-05-06 11:18:53 UTC
What's the exact problem here?

\e[4m enables underline, \e[24m disables it. The URL is underlined accordingly.

On mouseover or Ctrl+Click, the trailing ⟩ is mistakenly considered as part of the URL, which it could easily be.  There's no standard on which characters are considered as part of an URL and which are not in a flowed text (e.g. what about a trailing comma or period), the best you can do is guess.  Gnome-terminal's guessing mechanism doesn't take the character attributes (e.g. underline) into account; I'm not sure how it could, and it's really not a common practice to underline URLs in terminals.

Even ruby's manpage is totally inconsistent; just a few lines above it encloses another URL in standard parentheses, and before that, two other ones in whitespaces.  And those aren't underlined either.

I think ruby's man page should be modified to surround the URLs by whitespaces, and to be consistent with underlines.

Note: I'm not using Red Hat or Fedora, and my groff generates a different output.  If I misunderstood you then please attach the relevant ruby.out.
Comment 3 Egmont Koblinger 2015-05-06 11:53:42 UTC
Okay, I found in the upstream report that your problem is with the inclusion of the trailing '⟩'.

What should happen in the following case?

$ echo 'See http://en.wikipedia.org/wiki/, http://en.wikipedia.org/wiki/⟩ and http://en.wikipedia.org/wiki/!'

There's no clear answer what gnome-terminal should do, it needs to guess.

One improvement could be to treat attribute changes as separators, in the spirit of bug 746307's suggestion.  Its usefulness is marginal (as URLs are hardly ever printed with special attributes) and the drawbacks are not yet seen.

Another approach could be to look at the symbol in front of the URL and ignore its counterpart at the end.  Tricky to implement (probably can't be done by regex matching), and would also only provide a partial solution for the whole problem set.
Comment 4 Vít Ondruch 2015-05-06 21:11:55 UTC
(In reply to Egmont Koblinger from comment #2)
> I think ruby's man page should be modified to surround the URLs by
> whitespaces, and to be consistent with underlines.

There is hardly anything to change in the manpage. The only possibility is to remove the link highlighting.

(In reply to Egmont Koblinger from comment #3)
> One improvement could be to treat attribute changes as separators, in the
> spirit of bug 746307's suggestion.  Its usefulness is marginal (as URLs are
> hardly ever printed with special attributes) and the drawbacks are not yet
> seen.

This is probably something which could solve the issue. Actually, the escape character should be interpreted as a word separator.
Comment 5 Egmont Koblinger 2015-05-07 10:10:24 UTC
> There is hardly anything to change in the manpage. The only possibility is
> to remove the link highlighting.

Nope, the story has nothing to do with highlighting, it's about those angle brackets.  Ruby could remove those.

The relevant line in ruby.1 is

.Aq Pa https://bugs.ruby-lang.org/projects/ruby/wiki/Contributors

According to mdoc(7), Aq stands for "angle quote", and Pa for "pathname or filename".

I performed a grep in all the 10.000+ manpages installed on my system.  Ruby and rake are the only ones that enclose the URL in a .Aq macro.  (A few others enclose email addresses in .Aq, I'm not sure if that's okay.  We properly highlight those (without the angle brackets), I'm not sure if such characters can be part of an email address or not (beginning of a username, or end of an intl domain name), but it's definitely way less widespread to have special characters in an email address than in a URL.)

> This is probably something which could solve the issue. Actually, the escape
> character should be interpreted as a word separator.

(Technically, it shouldn't be the escape character, but two adjacent cells having different attributes.  With screen drawing libraries such as ncurses, a URL is not necessarily printed in a single run, it can happen that another part of the screen with different attributes in printed in the middle, including tons of escape sequences, yet gnome-terminal should recognize and handle the URL.  It doesn't matter by which means it gets printed, it's the end result look that matters.)

-----

That being said, your proposed change of excluding '⟩' is as simple as adding this to PATHTERM_CLASS, so I'll do it along with a few others such as '»'.  But it won't solve the problem for konsole and perhaps other terminal emulators, so in the mean time I recommend you to get in touch with ruby folks and ask them not to use angle brackets here.
Comment 6 Vít Ondruch 2015-05-11 11:38:46 UTC
(In reply to Egmont Koblinger from comment #5)
> That being said, your proposed change of excluding '⟩' is as simple as
> adding this to PATHTERM_CLASS, so I'll do it along with a few others such as
> '»'.

Thank you.

> But it won't solve the problem for konsole and perhaps other terminal
> emulators, so in the mean time I recommend you to get in touch with ruby
> folks and ask them not to use angle brackets here.

I opened ticket in Ruby's tracker [1].


[1] https://bugs.ruby-lang.org/issues/11133
Comment 7 Christian Persch 2016-02-21 14:52:50 UTC
With the rewritten URL regex from bug 756038, the trailing > isn't recognised as part of the URL anymore, so let's call this FIXED.