Skip to contentSkip to conversation

ncurses: put symlinks to basic terminfo files in ncurses-terminfo-base package

PATCH In review Rasmus Villemoes 2 participants 3 messages Jul 23 – Jul 30

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 ncurses: put symlinks to basic terminfo files in ncurses-terminfo-base package

From: Rasmus Villemoes <[email protected]>

With only the ncurses-terminfo-base package installed (i.e. not the full ncurses-terminfo), systemd prints

Terminfo xterm-256color not found for /dev/console

That is despite 'xterm-256color' being one of those basic terminfo files that are manually split off and into the terminfo-base package, and placed under /etc/terminfo/. The reason is that systemd only looks in /usr/share/terminfo (see their have_terminfo_file() in src/basic/terminal-util.c).

Make sure that applications that only look in /usr/share/terminfo do find the basic terminfo files by packaging the symlinks along with the pointed-to files.

---
 meta/recipes-core/ncurses/ncurses.inc | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
meta/recipes-core/ncurses/ncurses.inc +5 -1
index ec265e63f2..8fff9a226f 100644
@@ -161,6 +161,9 @@ _install_cfgs = "\
   PKG_CONFIG_LIBDIR='${libdir}/pkgconfig' \
 "
 
+TERMINFO_BASE = "alacritty ansi console dumb linux rxvt screen screen-256color sun \
+  tmux tmux-256color vt52 vt100 vt102 vt200 vt220 xterm-color xterm-xfree86 xterm-256color"
+
 do_install() {
         # Order of installation is important; widec installs a 'curses.h'
         # header with more definitions and must be installed last hence.
@@ -182,7 +185,7 @@ do_install() {
 
         # include some basic terminfo files
         # stolen ;) from gentoo and modified a bit
-        for x in alacritty ansi console dumb linux rxvt screen screen-256color sun tmux tmux-256color vt52 vt100 vt102 vt200 vt220 xterm-color xterm-xfree86 xterm-256color
+        for x in ${TERMINFO_BASE}
         do
                 local termfile="$(find "${D}${datadir}/terminfo/" -name "${x}" 2>/dev/null)"
                 local basedir="$(basename $(dirname "${termfile}"))"
@@ -309,6 +312,7 @@ FILES:${PN}-terminfo = "\
 
 FILES:${PN}-terminfo-base = "\
   ${sysconfdir}/terminfo \
+  ${@' '.join(map(lambda x: '${datadir}/terminfo/'+x[0]+'/'+x, '${TERMINFO_BASE}'.split()))} \
 "
 
 RSUGGESTS:${PN}-libtinfo = "${PN}-terminfo"
Signature · 1 line
2.55.0
#1 lore raw

PATCH 2/2 ncurses: stop moving terminfo files from /usr/share to /etc

From: Rasmus Villemoes <[email protected]>

Why it is done that way is lost in history; the gentoo reference doesn't help much, as gentoo nowadays certainly doesn't move the terminfo files around like that.

This also drops the xterm -> xterm-color symlink. I don't think that symlink is appropriate nowadays either, as running

infocmp -L -d xterm xterm-color

shows that "xterm" (aka xterm-new, aka xterm-p370) has far more capabilities than "xterm-color". So instead, just add plain 'xterm' to the TERMINFO_BASE variable.

Moreover, as the xterm -> xterm-color symlink only existed under /etc, people who install the full ncurses-terminfo would have a /usr/share/terminfo/x/xterm which did not match /etc/terminfo/x/xterm, and which one an application would pick up is not obvious.

---
 meta/recipes-core/ncurses/ncurses.inc | 24 +-----------------------
 1 file changed, 1 insertion(+), 23 deletions(-)
meta/recipes-core/ncurses/ncurses.inc +1 -23
index 8fff9a226f..89668be363 100644
@@ -162,7 +162,7 @@ _install_cfgs = "\
 "
 
 TERMINFO_BASE = "alacritty ansi console dumb linux rxvt screen screen-256color sun \
-  tmux tmux-256color vt52 vt100 vt102 vt200 vt220 xterm-color xterm-xfree86 xterm-256color"
+  tmux tmux-256color vt52 vt100 vt102 vt200 vt220 xterm xterm-color xterm-xfree86 xterm-256color"
 
 do_install() {
         # Order of installation is important; widec installs a 'curses.h'
@@ -183,27 +183,6 @@ do_install() {
 
         cd narrowc
 
-        # include some basic terminfo files
-        # stolen ;) from gentoo and modified a bit
-        for x in ${TERMINFO_BASE}
-        do
-                local termfile="$(find "${D}${datadir}/terminfo/" -name "${x}" 2>/dev/null)"
-                local basedir="$(basename $(dirname "${termfile}"))"
-
-                if [ -n "${termfile}" ]
-                then
-                        install -d ${D}${sysconfdir}/terminfo/${basedir}
-                        mv ${termfile} ${D}${sysconfdir}/terminfo/${basedir}/
-                        ln -s /etc/terminfo/${basedir}/${x} \
-                                ${D}${datadir}/terminfo/${basedir}/${x}
-                fi
-        done
-        # i think we can use xterm-color as default xterm
-        if [ -e ${D}${sysconfdir}/terminfo/x/xterm-color ]
-        then
-                ln -sf xterm-color ${D}${sysconfdir}/terminfo/x/xterm
-        fi
-
         # create linker scripts for libcurses.so and libncurses to
         # link against -ltinfo when needed. Some builds might break
         # else when '-Wl,--no-copy-dt-needed-entries' has been set in
@@ -311,7 +290,6 @@ FILES:${PN}-terminfo = "\
 "
 
 FILES:${PN}-terminfo-base = "\
-  ${sysconfdir}/terminfo \
   ${@' '.join(map(lambda x: '${datadir}/terminfo/'+x[0]+'/'+x, '${TERMINFO_BASE}'.split()))} \
 "
 
Signature · 1 line
2.55.0
#2 lore raw

Re: [PATCH 2/2] ncurses: stop moving terminfo files from /usr/share to /etc

Quoted 15 lines · Rasmus Villemoes

From: Rasmus Villemoes <[email protected]>

Why it is done that way is lost in history; the gentoo reference doesn't help much, as gentoo nowadays certainly doesn't move the terminfo files around like that.

This also drops the xterm -> xterm-color symlink. I don't think that symlink is appropriate nowadays either, as running

infocmp -L -d xterm xterm-color

shows that "xterm" (aka xterm-new, aka xterm-p370) has far more capabilities than "xterm-color". So instead, just add plain 'xterm' to the TERMINFO_BASE variable.

Quoted 6 lines

Moreover, as the xterm -> xterm-color symlink only existed under /etc, people who install the full ncurses-terminfo would have a /usr/share/terminfo/x/xterm which did not match /etc/terminfo/x/xterm, and which one an application would pick up is not obvious.

Hi Rasmus,

The change looks good, please re-submit a v2 with the incorrect gentoo reference dropped from the commit message.

Best regards,

Signature · 1 line
Paul Barker