Control: tags -1 + patch

On 2023-01-08 18:17 +0100, Sven Joachim wrote:

> Source: unibilium
> Version: 2.1.0-1
>
> The parse-terminfo autopkgtest uses a wrong directory for terminfo files
> below /usr:
>
> ,----
> | for term in ansi xterm screen rxvt-unicode; do
> |   libterm=/lib/terminfo/${term%${term#?}}/${term}
> |   usrterm=/usr/${libterm}
> `----
>
> The (bulk of the) terminfo database is located below /usr/share/terminfo
> rather than /usr/lib/terminfo.  For now this does not matter as we
> install the basic terminfo files in ncurses-base under /lib/terminfo,
> but after the Bookworm release I plan to relocate them to
> /usr/share/terminfo, see https://bugs.debian.org/1028202.  Once that
> happens, your test will still succeed but not do anything, if I read it
> correctly.

That seems to be quite easily fixed with a one-liner.

From 1ee726065fbffa0da996e2ab4663f0d7c82c807e Mon Sep 17 00:00:00 2001
From: Sven Joachim <svenj...@gmx.de>
Date: Wed, 11 Jan 2023 17:26:33 +0100
Subject: [PATCH 1/2] autopkgtest: Look for terminfo files under
 /usr/share/terminfo

The terminfo database in Debian is distributed among the directories
/lib/terminfo (ncurses-base) and /usr/share/terminfo (ncurses-term),
future releases might relocate all terminfo files to
/usr/share/terminfo as per https://bugs.debian.org/1028202.

Closes: #1028231
---
 debian/tests/parse-terminfo | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/debian/tests/parse-terminfo b/debian/tests/parse-terminfo
index 43c4fee..36ae634 100755
--- a/debian/tests/parse-terminfo
+++ b/debian/tests/parse-terminfo
@@ -10,7 +10,7 @@ FAIL=0
 TESTS=0
 for term in ansi xterm screen rxvt-unicode; do
   libterm=/lib/terminfo/${term%${term#?}}/${term}
-  usrterm=/usr/${libterm}
+  usrterm=/usr/share/${term%${term#?}}/${term}
   if [ -e "$libterm" ]; then
     printf "# Parsing $libterm ...\\n"
     TESTS=$((TESTS + 1))
--
2.39.0

> There is also a flawed logic in the parse-terminfo script, it expects
> that any foo-256color terminfo entry is located at the same place as its
> foo counterpart.  For the terminfo entries tested this currently holds
> true, but it is not guaranteed as long as the terminfo files are split
> among multiple directories.

I have attempted to fix that logic with the patch below, and created a
merge request on Salsa:
https://salsa.debian.org/jamessan/unibilium/-/merge_requests/2.

Cheers,
       Sven

From a1e47a6c605ad84c9a983b80ff411d13d9b6b4d1 Mon Sep 17 00:00:00 2001
From: Sven Joachim <svenj...@gmx.de>
Date: Wed, 11 Jan 2023 17:36:05 +0100
Subject: [PATCH 2/2] autopkgtest: Fix logic to find -256color terminfo entries

The code assumed that a terminfo entry and its -256color pendant
always exits in the same directory, which is not guaranteed.
---
 debian/tests/parse-terminfo | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/debian/tests/parse-terminfo b/debian/tests/parse-terminfo
index 36ae634..042a80e 100755
--- a/debian/tests/parse-terminfo
+++ b/debian/tests/parse-terminfo
@@ -15,20 +15,19 @@ for term in ansi xterm screen rxvt-unicode; do
     printf "# Parsing $libterm ...\\n"
     TESTS=$((TESTS + 1))
     ./tdump "$libterm" || FAIL=1
-    if [ -e "${libterm}-256color" ]; then
-      printf "# Parsing ${libterm}-256color ...\\n"
-      TESTS=$((TESTS + 1))
-      ./tdump "${libterm}-256color" || FAIL=1
-    fi
   elif [ -e "$usrterm" ]; then
     printf "# Parsing $usrterm ...\\n"
     TESTS=$((TESTS + 1))
     ./tdump "$usrterm" || FAIL=1
-    if [ -e "${usrterm}-256color" ]; then
-      printf "# Parsing ${usrterm}-256color ...\\n"
-      TESTS=$((TESTS + 1))
-      ./tdump "${usrterm}-256color" || FAIL=1
-    fi
+  fi
+  if [ -e "${libterm}-256color" ]; then
+    printf "# Parsing ${libterm}-256color ...\\n"
+    TESTS=$((TESTS + 1))
+    ./tdump "${libterm}-256color" || FAIL=1
+  elif [ -e "${usrterm}-256color" ]; then
+    printf "# Parsing ${usrterm}-256color ...\\n"
+    TESTS=$((TESTS + 1))
+    ./tdump "${usrterm}-256color" || FAIL=1
   fi
 done
 printf "1..${TESTS}\\n"
--
2.39.0

Reply via email to