[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: Strange behavior of Ncurses
From: |
Urban Söderberg |
Subject: |
RE: Strange behavior of Ncurses |
Date: |
Fri, 11 Oct 2024 13:18:16 +0000 |
Hi Thomas,
We did strace on our application and could see that character sequences are
caused by ncurses.
File: dev-pts-2-trace3.log
Printout lines starting with spaces.
We can see several lines like this:
[pid 2001732] 12:04:54.106158 write(1</dev/pts/2<char 136:2>>,
"\33[J\33[1;17H", 10) = 10 <0.000015>
This causes issues.
File: nr-dev-pts-2-trace.log
Same printout but each line starting with a number.
Here we do not see lines like the one showed above.
Everything works perfect.
Cursor-handling in our application looks fine, so no error move is not made.
As earlier mentioned in previous email, the implementation was made several
years ago.
Recently a customer discovered the issue with certain printouts.
Can you please have a look deeper into this.
We would very much appreciate it.
Best regards
Urban
-----Original Message-----
From: Thomas Dickey <dickey@his.com>
Sent: Thursday, 10 October 2024 00:28
To: Urban Söderberg <Urban.Soderberg@knowit.se>
Cc: bug-ncurses@gnu.org; Gustav W. Uppenberg <gustav.uppenberg@knowit.se>;
Roxana Prelipceanu <roxana.prelipceanu@knowit.se>; Pauline Littbrand
<pauline.littbrand@knowit.se>; Kristoffer Mattila <kristoffer.mattila@knowit.se>
Subject: Re: Strange behavior of Ncurses
On Wed, Oct 09, 2024 at 01:35:30PM +0000, Urban Söderberg via Bug reports for
ncurses, the GNU implementation of curses wrote:
> Hi Ncurses!
>
> We are using Ncurses C++ (6.1) in Linux to handle terminal-communication.
> The actual development was made several years ago.
> Recently a customer discovered an issue with certain printouts that have
> repeated/similar lines and with several spaces.
>
> Short description of the use-case:
> From a webpage a websocket is used to handle communication with our client.
> Our client is started and Ncurses is used for input/output.
> When a command is run the printout is presented in terminal-screen.
>
>
> An example when issue is seen:
> File: printout_similar_lines_and_several_spaces.png
> Here is the visible data alright but not all data when for example scrolling
> back in browsers terminal to see the upper part.
> Websocket shows that data is written from row 1 to 63 and after this a jump
> is made to row 1.
Reading the trace, I don't see that many rows (it's using cursor addressing up
to line 24) -- but knowing the screensize would help understand the trace.
If the application believes the screensize is 24x80, but the actual terminal is
not that size, you will see odd behavior.
That can happen with a serial connection. If your application permits setting
environment variables, setting LINES and COLUMNS to the actual screensize is
the usual workaround.
> Backspaces are seen as well.
If it's actually using ncurses (and not for example some terminfo-level code),
then ncurses may use backspaces if the terminal description's cub1 capability,
e.g.,
cub1=^H,
You could override that by changing it to
cub1=\E[D,
or disable that:
cub1@,
But without a correct screensize, scrolling and cursor movement will not work
properly.
That trace begins oddly. The \E[xxC's are right-cursor movement. But moving
the cursor right by 72 columns and _then_ starting a new line isn't something
that I'd expect to see from ncurses:
\E[72C
\nSCCP POLICING SPECIFICATION DATA
\E[47C
\n
\E[79C
\nOPERATING
\E[70C
\n
\E[79C
\nPCODE PI
\E[7CPVF
\E[24;30HPVAL
\E[46C
\n610 CGNS
Further, there's no explicit scrolling region in the trace (nor any
initialization), and most of the cursor addressing is to columns 17 or 30.
I'm skeptical that it's using anything other than terminfo (or even termcap).
While ncurses provides those interfaces, it has no control over how an
application uses the data.
Presumably I'm not going to see the source code, but a list of the ncurses
functions which this program calls should be something that you can provide.
> When exporting the total received data the printout is corrupt, lines missing
> and some overwritten.
> We see corrupt printout when viewing the received data, file:
> full_data_lines_are_missing_due_to_jump_back_to_line_1_ad_backspaces_s
> een.png
>
> Also see attached file: websocket_data_received_from_ncurses.txt
> Jump to row 1 is seen and some backspaces etc.
>
> How correct printout look like, file:
> Actual_command_and_its_printout.log
>
>
> An example when a printout is alright:
> File: printout_unique_lines_few_spaces Here is the visual data
> alright.
> When checking websocket no jump to row 1 is seen.
> Websocket shows that data is written from row 1 to 63 and after that row 63
> is used.
> When exporting output all rows are present.
>
>
> This jump back to row 1 and the backspaces really causes problem to us.
> Is there a way to get rid of that handling or is there any correction done in
> Ncurses?
>
>
> Best regards
> Urban
--
Thomas E. Dickey <dickey@invisible-island.net> https://invisible-island.net
cols_149_rows_60.PNG
Description: cols_149_rows_60.PNG
dev-pts-2-trace3.log
Description: dev-pts-2-trace3.log
nr-dev-pts-2-trace.log
Description: nr-dev-pts-2-trace.log
- Strange behavior of Ncurses, Urban Söderberg, 2024/10/09
- Re: Strange behavior of Ncurses, Thomas Dickey, 2024/10/09
- RE: Strange behavior of Ncurses,
Urban Söderberg <=
- Re: Strange behavior of Ncurses, G. Branden Robinson, 2024/10/11
- Re: Strange behavior of Ncurses, Thomas Dickey, 2024/10/12
- RE: Strange behavior of Ncurses, Urban Söderberg, 2024/10/16
- Re: ***UNCHECKED*** RE: Strange behavior of Ncurses, Thomas Dickey, 2024/10/16
- RE: ***UNCHECKED*** RE: Strange behavior of Ncurses, Urban Söderberg, 2024/10/17
- Re: ***UNCHECKED*** RE: Strange behavior of Ncurses, Thomas Dickey, 2024/10/17
- RE: ***UNCHECKED*** RE: Strange behavior of Ncurses, Urban Söderberg, 2024/10/18
- Re: ***UNCHECKED*** RE: Strange behavior of Ncurses, G. Branden Robinson, 2024/10/18
- RE: ***UNCHECKED*** RE: Strange behavior of Ncurses, Urban Söderberg, 2024/10/18
- Re: RE: Strange behavior of Ncurses, Thomas Dickey, 2024/10/18