Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hyperlink escape sequence causes bad output in Ubuntu 16 LTS terminal #10428

Closed
jay opened this issue Feb 7, 2023 · 5 comments
Closed

Hyperlink escape sequence causes bad output in Ubuntu 16 LTS terminal #10428

jay opened this issue Feb 7, 2023 · 5 comments

Comments

@jay
Copy link
Member

jay commented Feb 7, 2023

I did this

curl --head https://www.google.com

In Ubuntu 16 LTS terminal the location header has unrecognized escape sequences and duplicate URL.

location:�]8;;https://www.google.com/�\ https://www.google.com/
�]8;;�\content-type: text/html; charset=UTF-8

Capture

/cc @dfandrich

@dfandrich
Copy link
Contributor

dfandrich commented Feb 7, 2023 via email

@jay
Copy link
Member Author

jay commented Feb 7, 2023

Gnome Terminal 3.18.3 + VTE 0.42.5

@bagder
Copy link
Member

bagder commented May 3, 2023

@dfandrich is this only because of an older gnome terminal and we can just ask users to run a later version or is there anything more clever we can here?

@dfandrich
Copy link
Contributor

OSC 8 support was added to Gnome Terminal 6 years ago in ver. 3.25.1. There's a list tracking support in terminal emulators on this page. The OSC 8 spec also says

Any terminal that correctly implements OSC parsing according to ECMA-48 is guaranteed not to suffer from compatibility issues. That is, even if explicit hyperlinks aren't supported, the target URI is silently ignored and the supposed-to-be-visible text is displayed, without artifacts.

It sounds like there may have been a bug in Gnome Terminal that didn't do this, but other terminal emulators, even those that don't support OSC 8, should ignore the extra data and that is what I found in my testing. That spec page lists four terminal emulators that still didn't work properly as of 3 years ago, but all of them are working (mostly) today in their latest versions.

I can't think how we could easily and reliably detect whether a terminal emulator is buggy or not and dynamically enable this. xterm-style answerback strings might theoretically do it if those were still a thing, otherwise it would take linking with an X11 library and even that wouldn't work all the time. My suggestion would be to just use --no-styled-output on those few cases where it doesn't work, or better yet, upgrade your terminal emulator since there aren't any known buggy implementations left according to that page.

jay added a commit to jay/curl that referenced this issue May 3, 2023
- Disable hyperlink formatting for the 'Location:' header value in VTE
  0.48.1 and earlier, since it is buggy in those versions.

Prior to this change those terminals may show the location header value
as gibberish or show it twice.

Ref: https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda#backward-compatibility

Fixes curl#10428
Closes #xxxx
@jay
Copy link
Member Author

jay commented May 3, 2023

That page also says VTE versions up to 0.48.1 (6 years ago) have bugs so I've submitted #11071 to test VTE_VERSION env var

jay added a commit to jay/curl that referenced this issue May 4, 2023
- Disable hyperlink formatting for the 'Location:' header value in VTE
  0.48.1 and earlier, since it is buggy in some of those versions.

Prior to this change those terminals may show the location header value
as gibberish or show it twice.

Ref: https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda#backward-compatibility

Fixes curl#10428
Closes #xxxx
@jay jay closed this as completed in 30ba26d May 5, 2023
bch pushed a commit to bch/curl that referenced this issue Jul 19, 2023
- Disable hyperlink formatting for the 'Location:' header value in VTE
  0.48.1 and earlier, since it is buggy in some of those versions.

Prior to this change those terminals may show the location header value
as gibberish or show it twice.

Ref: https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda#backward-compatibility

Fixes curl#10428
Closes curl#11071
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

3 participants