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

curl --manual includes ESC-sequences #11501

Closed
VictorVG opened this issue Jul 23, 2023 · 7 comments
Closed

curl --manual includes ESC-sequences #11501

VictorVG opened this issue Jul 23, 2023 · 7 comments

Comments

@VictorVG
Copy link

VictorVG commented Jul 23, 2023

I did this

Original user bug-report in to the forum.ru-board post, (translated) :

ozr1

I downloaded curl 8.2.0_1 from the project suite, I launched "curl --manual> curl.txt" and saw that the file was clogged with >ESC-sequence which was not noticed behind the previous ones (8.1.2 and below).

Accordingly, the question is: how to read this "manual" now? Or, how to remove all these ESC-sequence from it from it?

Sent: 17:14 22-07-2023"

try test use command:

curl --manual > manual.txt

then see this file in to any text editor, see example

20230723_034452

I expected the following

Clean ASCII text w/o ESC sequence's like cURL 8.1.2.

curl/libcurl version

cURL 8.2.0

operating system

Any (all) OS and platform's

@dfandrich
Copy link
Contributor

dfandrich commented Jul 23, 2023 via email

@VictorVG
Copy link
Author

VictorVG commented Jul 23, 2023

Yes, show. Notepad manual.txt

20230723_045941

Original text is manual.txt.zip

cleaned text is (use internal editor in to Far Manager b6174 + LuaFAR Search v3.45.5 + TextConv v3.9.3.4040 (used as simple tool for clean tab's) and Far regxp (?:\[)\d+(?:m) for clean ESC-symbols) - in to report i see whets find "only" 3390 ESC-synbols's. Cleaned out file manual_clean.zip don't include ESC-symbol's and can simple read.

@VictorVG VictorVG changed the title cURL 8.2.0 build 8.2.0_1 for Windows: try curl --manual > manual.txt and in the output file see garbage cURL 8.2.0 build 8.2.0_1 for Windows: try curl --manual > manual.txt and in the output file see garbage as ESC-symbols Jul 23, 2023
@VictorVG VictorVG changed the title cURL 8.2.0 build 8.2.0_1 for Windows: try curl --manual > manual.txt and in the output file see garbage as ESC-symbols cURL 8.2.0 build 8.2.0_1 for Windows: try "curl --manual > manual.txt" and in the output file see garbage as ESC-symbols Jul 23, 2023
@VictorVG
Copy link
Author

VictorVG commented Jul 23, 2023

use grep and regexp I find gardable ESC-seqences in to some source files (partial):

curl-8.2.0\src\tool_hugehelp.c : 3390

�[4mcurl�[24m(1)                           curl Manual                          �[4mcurl�[24m(1)\n
�[1mNAME�[0m\n
�[1mSYNOPSIS�[0m\n
       �[1mcurl [options / URLs]�[0m\n
�[1mDESCRIPTION�[0m\n
       �[1mcurl  �[22mis  a tool for transferring data from or to a server. It supports\n
       �[4mlibcurl(3)�[24m for details.\n
�[1mURL�[0m\n

full grep report.txt

also see diff for details diff.txt

@VictorVG VictorVG changed the title cURL 8.2.0 build 8.2.0_1 for Windows: try "curl --manual > manual.txt" and in the output file see garbage as ESC-symbols cURL 8.2.0: try "curl --manual > manual.txt" and in the output file see garbage then /src/tool_hugehelp.c included garbage ESC-sequenc's Jul 23, 2023
@VictorVG VictorVG changed the title cURL 8.2.0: try "curl --manual > manual.txt" and in the output file see garbage then /src/tool_hugehelp.c included garbage ESC-sequenc's cURL 8.2.0: try "curl --manual > manual.txt" and in the output file see garbage then /src/tool_hugehelp.c included garbage ESC-sequence's Jul 23, 2023
@dfandrich
Copy link
Contributor

I don't doubt that you see this. But, where did you get the curl archive that shows this problem?

@VictorVG
Copy link
Author

VictorVG commented Jul 23, 2023

Archive manual.txt.zip is show this problem.

Also, additional archive manual-8.2.0.zip

make use command:

curl --manual > manual.txt & curl --version > version.txt & curl --help > curl.txt & curl --help all > help.txt

And simply compared using Diff's sources downloaded from the project using my script curld.cmd

@echo off
setlocal enableextensions
curl -lso 1.tmp https://curl.se/windows/
findstr /C:"<b>curl version</b>: " 1.tmp > 2.tmp
for /f "tokens=3 delims=: " %%a in (2.tmp) do set p1=%%a
findstr /C:"<b>Build</b>: " 1.tmp > 2.tmp
for /f "tokens=2 delims=: " %%a in (2.tmp) do set p2=%%a
del /f/q 1.tmp 2.tmp > nul
for %%A in (
            tar.bz2
            tar.gz
            tar.xz
            zip
            ) do curl -C - -LRZO --create-dirs --output-dir cURL\src https://curl.se/download/curl-%p1%.%%A
for %%A in (
            tar.xz
            zip
            ) do curl -C - -LRZO --create-dirs --output-dir cURL\x86 https://curl.se/windows/dl-%p2%/curl-%p2%-win32-mingw.%%A
for %%A in (
            tar.xz
            zip
            ) do curl -C - -LRZO --create-dirs --output-dir cURL\x64 https://curl.se/windows/dl-%p2%/curl-%p2%-win64-mingw.%%A
for %%A in (
            tar.xz
            zip
            ) do curl -C - -LRZO --create-dirs --output-dir cURL\arm64 https://curl.se/windows/dl-%p2%/curl-%p2%-win64a-mingw.%%A
exit

P.S.

Some elements in it are unnecessary - habit. It’s so easier for me not to get confused.

@gvanem
Copy link
Contributor

gvanem commented Jul 23, 2023

From https://linux.die.net/man/1/grotty, which is involved in the generation:

By default, grotty emits SGR escape sequences (from ISO 6429, also called ANSI color escapes) to change
text attributes (bold, italic, colors).
....
Environment
GROFF_NO_SGR
If set, the old drawing scheme for bold and underline (using the backspace character) is active. Colors are disabled.

So if you're able to build curl.exe yourself, add a set GROFF_NO_SGR=1 before building.

Or get the the less program to view it. Here it shows this with less -R manual.txt:
curl-manual-less

Those pesky SGR sequences gets interpreted by less itself.

bagder added a commit that referenced this issue Jul 23, 2023
At some point the nroff command stopped stripping off escape sequences,
so then this script needs to do the job instead.

Reported-by: VictorVG on github
Fixes #11501
@bagder bagder changed the title cURL 8.2.0: try "curl --manual > manual.txt" and in the output file see garbage then /src/tool_hugehelp.c included garbage ESC-sequence's curl --manual includes ESC-sequences Jul 23, 2023
@bagder bagder closed this as completed in e310497 Jul 23, 2023
@VictorVG
Copy link
Author

@bagder

Big thanks! I test new version 8.2.1 build 8.2.1_1 - this issues is fixed!:up:

ptitSeb pushed a commit to wasix-org/curl that referenced this issue Sep 25, 2023
At some point the nroff command stopped stripping off escape sequences,
so then this script needs to do the job instead.

Reported-by: VictorVG on github
Fixes curl#11501
Closes curl#11503
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.

4 participants