History log of /netbsd-src/tests/lib/libcurses/check_files/addch.chk (Results 1 – 4 of 4)
Revision Date Author Comments
# 609d11bc 13-Feb-2021 rillig <rillig@NetBSD.org>

libcurses: fix wrong tab width for addch

In sysinst, the installation screen is indented with tabs. Sysinst uses
msgc, which brings its own text layout engine. This engine does not use
addbytes bu

libcurses: fix wrong tab width for addch

In sysinst, the installation screen is indented with tabs. Sysinst uses
msgc, which brings its own text layout engine. This engine does not use
addbytes but addch. In addch, the x position for each tab was advanced
twice as much as needed. The menu items were thus not indented by 8
spaces but by 16, which caused an ugly line break in the German
translation.

This bug largely went unnoticed because most other applications use
addbytes instead, which worked fine all the time. It had been
introduced somewhere between NetBSD 8.0 and NetBSD 9.0.

The code around this bug used aliased variables for win->curx and
win->cury a lot. Getting this right is difficult and needs a thorough
test suite. Even though libcurses has 201 tests, that is not nearly
enough to cover all the relations between the various functions in
libcurses that call each other, crossing API boundaries from internal
to external, doing character conversions on the way and juggling around
4 different types of characters (char, wchar_t, chtype, cchar_t).

The simplest fix was to remove all this aliasing, while keeping the
API the same. If _cursesi_waddbytes is not considered part of the API,
it would be possible to replace px with win->curx in all places, same
for py and win->cury.

The complicated code with the aliasing may have been meant for
performance reasons, but it's hard to see any advantage if both points
of truth need to be synchronized all the time.

Libcurses can be built in 2 modes: with wide character support or
without (-DDISABLE_WCHAR). The test suite only covers the variant with
wide characters. The single-byte variant has to be tested manually.
Running sysinst with the single-byte libcurses produces the correct
layout.

show more ...


# 25d40489 07-Feb-2021 rillig <rillig@NetBSD.org>

libcurses: demonstrate bug in addch that doubles tab indentation

When adding "\t" via addch, win.curx advances by twice the spaces as
intended. This bug was introduced somewhere between NetBSD 8.0

libcurses: demonstrate bug in addch that doubles tab indentation

When adding "\t" via addch, win.curx advances by twice the spaces as
intended. This bug was introduced somewhere between NetBSD 8.0 and 9.0.

Adding "\t" via addstr does not have this bug.

This bug causes the installation menu of sysinst to be have its menu
items indented by 16 characters instead of only 8. This in turn
produces an ugly line break in the German translation.

The test framework for libcurses is not well integrated into ATF.
Whenever the expected output is longer than the actual output, or vice
versa, the test passes nevertheless. This makes it necessary to
constantly look into atf-run.log to see whether the actual output is
indeed equal to the expected output, which is crucial, especially for
telling the difference between addstr and addnstr.

Reusing the .chk files for several tests is not a good idea either. For
example, addstr and waddstr are supposed to produce the same result for
ASCII-only text, so it was tempting to use the same file. But waddstr
seems to have a bug (maybe undefined behavior), at least waddstr returns
ERR in one case where it shouldn't. This means that currently the
expected output (acknowledging the bug) must be different.

The "expected" test output in waddstr.chk looks completely broken, but
that's exactly what the test produces right now.

show more ...


# ce321bb0 24-Oct-2020 blymn <blymn@NetBSD.org>

Merge in code from Google Summer of Code project which dramatically
increases the number of tests performed.

Thanks to Naman Jain <jnaman806@gmail.com> for his excellent work on
this GSoC project.


# bdd37afa 10-Apr-2011 blymn <blymn@NetBSD.org>

Add atf for libcurses with some tests