From 07a231717fe38e030a6a3f9c696784d3858990df Mon Sep 17 00:00:00 2001 From: "Sebastian J. Bronner" Date: Wed, 30 Oct 2019 23:46:14 +0100 Subject: Improve availability of functional terminfo entries --- .SRCINFO | 6 ++++- PKGBUILD | 29 ++++++++++---------- README.terminfo.rst | 77 +++++++++++++++++++++++++++++++++++++++++++++++++++++ terminfo.patch | 12 +++++++++ 4 files changed, 109 insertions(+), 15 deletions(-) create mode 100644 README.terminfo.rst create mode 100644 terminfo.patch diff --git a/.SRCINFO b/.SRCINFO index ff171f7..26789ae 100644 --- a/.SRCINFO +++ b/.SRCINFO @@ -1,7 +1,7 @@ pkgbase = st pkgdesc = A simple virtual terminal emulator for X. pkgver = 0.8.2 - pkgrel = 7 + pkgrel = 8 url = https://st.suckless.org arch = i686 arch = x86_64 @@ -11,7 +11,11 @@ pkgbase = st makedepends = ncurses depends = libxft source = https://dl.suckless.org/st/st-0.8.2.tar.gz + source = terminfo.patch + source = README.terminfo.rst sha256sums = aeb74e10aa11ed364e1bcc635a81a523119093e63befd2f231f8b0705b15bf35 + sha256sums = b282c0b963a24299d02e485af30260d237ca2e8e6b06282d385022c9c10a0950 + sha256sums = 9a1b764cedd3a6288cc6601a3cdce06f4ab993f44de7aea5afd69511c13df7c0 pkgname = st diff --git a/PKGBUILD b/PKGBUILD index 7ad8f2e..e3196d1 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -5,24 +5,24 @@ pkgname=st pkgver=0.8.2 -pkgrel=7 +pkgrel=8 pkgdesc='A simple virtual terminal emulator for X.' arch=('i686' 'x86_64' 'armv7h') license=('MIT') depends=(libxft) makedepends=(libxext ncurses) url=https://st.suckless.org -source=(https://dl.suckless.org/$pkgname/$pkgname-$pkgver.tar.gz) -sha256sums=('aeb74e10aa11ed364e1bcc635a81a523119093e63befd2f231f8b0705b15bf35') -_makedir=$pkgname-$pkgver -_makeopts="--directory=$_makedir" +source=(https://dl.suckless.org/$pkgname/$pkgname-$pkgver.tar.gz + terminfo.patch + README.terminfo.rst) +sha256sums=(aeb74e10aa11ed364e1bcc635a81a523119093e63befd2f231f8b0705b15bf35 + b282c0b963a24299d02e485af30260d237ca2e8e6b06282d385022c9c10a0950 + 9a1b764cedd3a6288cc6601a3cdce06f4ab993f44de7aea5afd69511c13df7c0) +_sourcedir=$pkgname-$pkgver +_makeopts="--directory=$_sourcedir" prepare() { - # Do not install terminfo files, as they conflict with ncurses. - sed -r \ - -e '/^[[:space:]]+tic\>/d' \ - -e '/^[[:space:]]+@echo .* terminfo/d' \ - -i $_makedir/Makefile + patch --directory="$_sourcedir" --strip=0 < terminfo.patch # This package provides a mechanism to provide a custom config.h. Multiple # configuration states are determined by the presence of two files in @@ -45,7 +45,7 @@ prepare() { abort= if [ -e "$BUILDDIR/config.h" ] then - cp "$BUILDDIR/config.h" "$_makedir" + cp "$BUILDDIR/config.h" "$_sourcedir" elif [ ! -e "$BUILDDIR/config.def.h" ] then abort=1 @@ -55,7 +55,7 @@ prepare() { msg+='values. Then restart the build process.' error "$msg" fi - cp "$_makedir/config.def.h" "$BUILDDIR" + cp "$_sourcedir/config.def.h" "$BUILDDIR" test -z "$abort" } @@ -69,6 +69,7 @@ package() { local licdir="$shrdir/licenses/$pkgname" local docdir="$shrdir/doc/$pkgname" make $_makeopts PREFIX=/usr DESTDIR="$pkgdir" install - install $installopts "$licdir" "$_makedir/LICENSE" - install $installopts "$docdir" "$_makedir/README" + install $installopts "$licdir" "$_sourcedir/LICENSE" + install $installopts "$docdir" "$_sourcedir/README" + install $installopts "$docdir" README.terminfo.rst } diff --git a/README.terminfo.rst b/README.terminfo.rst new file mode 100644 index 0000000..c5f4b6d --- /dev/null +++ b/README.terminfo.rst @@ -0,0 +1,77 @@ +Terminfo Entries +================ + +:Author: Sebastian J. Bronner +:Date: 2019-10-30 +:URL: https://aur.archlinux.org/packages/st + +The Problem +----------- + +Most Linux-based distributions will have the bulk of their terminfo entries in +the ``ncurses`` package. These live in ``/usr/share/terminfo``. There you will +find several entries for ``st``. These, however, do not work well with current +versions of ``st``. You need the terminfo entries supplied with ``st``. + +Specifically, I have observed the following issues when using the terminfo +entries supplied with ``ncurses``: + +* Start ``st``. +* Run ``tmux`` in the ``st`` window. +* Run ``nvim`` in ``tmux``. + + * ``tmux`` will crash immediately with the following message: + + .. code:: console + + [lost server] + % + +* Run ``w3m`` with any URL in ``tmux``. + + * ``w3m`` will not react to any key presses (most notably the arrow keys and + ``q``) and must be terminated with ``killall w3m``. + * The command line returned where ``w3m`` was running will show all the + missing keypresses. + +For reference, I performed these tests using the following software versions: +``st`` 0.8.2, ``tmux`` 2.9_a, ``neovim`` 0.4.2, and ``w3m`` +0.5.3.git20190105-1. + +The Solution +------------ + +The ``ncurses`` package should stop shipping terminfo entries for ``st``. These +should then be provided in ``/usr/share/terminfo`` by this (and other) ``st`` +packages. The conflicting terminfo entries are + +* ``st`` and +* ``st-256color``. + +Additional entries that could be considered for removal from ``ncurses`` are + +* ``st-0.6``, +* ``st-0.7``, +* ``st-16color``, +* ``st-direct``, +* ``stterm`` (for distributions that rename ``st`` to ``stterm``), +* ``stterm-16color``, and +* ``stterm-256color``. + +This solution cannot be implemented without the cooperation of ``ncurses`` +since many distributions (including Arch Linux) do not allow for two packages +that provide files with identical paths to be installed side-by-side. +Therefore, I am bringing this to the attention of the ``ncurses`` team. + +The Workaround +-------------- + +A somewhat painful, albeit pragmatic, workaround is as follows: A user that +encounters issues that are due to mismatched terminfo entries, such as those +above, can symlink the terminfo entries included in this package into her +user-level terminfo database using the following commands: + +.. code:: shell + + mkdir ~/.terminfo/s + ln -s /usr/share/st/terminfo/s/* ~/.terminfo/s diff --git a/terminfo.patch b/terminfo.patch new file mode 100644 index 0000000..e91e91f --- /dev/null +++ b/terminfo.patch @@ -0,0 +1,12 @@ +--- Makefile 2019-02-09 12:50:41.000000000 +0100 ++++ Makefile 2019-10-30 23:39:55.775193275 +0100 +@@ -47,7 +47,8 @@ + mkdir -p $(DESTDIR)$(MANPREFIX)/man1 + sed "s/VERSION/$(VERSION)/g" < st.1 > $(DESTDIR)$(MANPREFIX)/man1/st.1 + chmod 644 $(DESTDIR)$(MANPREFIX)/man1/st.1 +- tic -sx st.info ++ mkdir -p $(DESTDIR)$(PREFIX)/share/st/terminfo ++ tic -sx -o $(DESTDIR)$(PREFIX)/share/st/terminfo st.info + @echo Please see the README file regarding the terminfo entry of st. + + uninstall: -- cgit v1.2.3