From 07a231717fe38e030a6a3f9c696784d3858990df Mon Sep 17 00:00:00 2001 From: "Sebastian J. Bronner" Date: Wed, 30 Oct 2019 23:46:14 +0100 Subject: [PATCH 1/4] 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: From eb4d0d26b0c8f6cf9a44e79cc1ab7dbf6466d795 Mon Sep 17 00:00:00 2001 From: "Sebastian J. Bronner" Date: Thu, 31 Oct 2019 01:56:15 +0100 Subject: [PATCH 2/4] Change message about config.h on first run from error to warning --- .SRCINFO | 2 +- PKGBUILD | 41 +++++++++++++++++++---------------------- 2 files changed, 20 insertions(+), 23 deletions(-) diff --git a/.SRCINFO b/.SRCINFO index 26789ae..05aa389 100644 --- a/.SRCINFO +++ b/.SRCINFO @@ -1,7 +1,7 @@ pkgbase = st pkgdesc = A simple virtual terminal emulator for X. pkgver = 0.8.2 - pkgrel = 8 + pkgrel = 9 url = https://st.suckless.org arch = i686 arch = x86_64 diff --git a/PKGBUILD b/PKGBUILD index e3196d1..299e8f4 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -5,7 +5,7 @@ pkgname=st pkgver=0.8.2 -pkgrel=8 +pkgrel=9 pkgdesc='A simple virtual terminal emulator for X.' arch=('i686' 'x86_64' 'armv7h') license=('MIT') @@ -28,35 +28,32 @@ prepare() { # configuration states are determined by the presence of two files in # $BUILDDIR: # - # * config.h: The user has supplied his or her configuration. The file will - # be copied to $srcdir and used during build. - # * config.def.h only: The user was previously made aware of the - # configuration options and has opted not to make any configuration - # changes. The package is built using default values. - # * neither file: Initial state. The user receives a message on how to - # configure this package. The build process is aborted after the copy - # operation below. + # config.h config.def.h state + # ======== ============ ===== + # absent absent Initial state. The user receives a message on how + # to configure this package. + # absent present The user was previously made aware of the + # configuration options and has not made any + # configuration changes. The package is built using + # default values. + # present The user has supplied his or her configuration. The + # file will be copied to $srcdir and used during + # build. # - # After this test, config.def.h is copied from $srcdir to provide an up to - # date template for the user. If neither file was present initially, further - # build steps are aborted at this point. Even if no config.h is provided, - # future runs will proceed with default values due to the presence of - # config.def.h. - abort= + # After this test, config.def.h is copied from $srcdir to $BUILDDIR to + # provide an up to date template for the user. if [ -e "$BUILDDIR/config.h" ] then cp "$BUILDDIR/config.h" "$_sourcedir" elif [ ! -e "$BUILDDIR/config.def.h" ] then - abort=1 - msg='This package can be configured in config.h. Copy config.def.h just ' - msg+='placed into the package directory to config.h and modify it to ' - msg+='change the configuration. Or just leave it alone to use default ' - msg+='values. Then restart the build process.' - error "$msg" + msg='This package can be configured in config.h. Copy the config.def.h ' + msg+='that was just placed into the package directory to config.h and ' + msg+='modify it to change the configuration. Or just leave it alone to ' + msg+='continue to use default values.' + warning "$msg" fi cp "$_sourcedir/config.def.h" "$BUILDDIR" - test -z "$abort" } build() { From 0ce8ba0ecf338a512b2f275a305fca7012b2271d Mon Sep 17 00:00:00 2001 From: "Sebastian J. Bronner" Date: Thu, 7 Nov 2019 00:19:19 +0100 Subject: [PATCH 3/4] Update terminfo explanation and workaround --- PKGBUILD | 8 ++--- README.terminfo.rst | 71 +++++++++++++++++++++++++++------------------ terminfo.patch | 23 +++++++++++---- 3 files changed, 64 insertions(+), 38 deletions(-) diff --git a/PKGBUILD b/PKGBUILD index 299e8f4..7c5e658 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -5,19 +5,18 @@ pkgname=st pkgver=0.8.2 -pkgrel=9 +pkgrel=10 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 terminfo.patch README.terminfo.rst) sha256sums=(aeb74e10aa11ed364e1bcc635a81a523119093e63befd2f231f8b0705b15bf35 - b282c0b963a24299d02e485af30260d237ca2e8e6b06282d385022c9c10a0950 - 9a1b764cedd3a6288cc6601a3cdce06f4ab993f44de7aea5afd69511c13df7c0) + bf6c8b73a606a8e513c7919d91f93ed7aeb5f44e80269bb244cc01659145a5ea + 0ebcbba881832adf9c98ce9fe7667c851d3cc3345077cb8ebe32702698665be2) _sourcedir=$pkgname-$pkgver _makeopts="--directory=$_sourcedir" @@ -69,4 +68,5 @@ package() { install $installopts "$licdir" "$_sourcedir/LICENSE" install $installopts "$docdir" "$_sourcedir/README" install $installopts "$docdir" README.terminfo.rst + install $installopts "$shrdir/$pkgname" "$_sourcedir/st.info" } diff --git a/README.terminfo.rst b/README.terminfo.rst index c5f4b6d..cd724d0 100644 --- a/README.terminfo.rst +++ b/README.terminfo.rst @@ -2,16 +2,16 @@ Terminfo Entries ================ :Author: Sebastian J. Bronner -:Date: 2019-10-30 +:Date: 2019-11-06 :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``. +Most Linux-based distributions will have their terminfo entries in the +``ncurses`` package. These live in ``/usr/share/terminfo``. There you will find +several entries for ``st``. As of ``ncurses-6.1`` as packaged in ArchLinux, +these, do not work well with current versions of ``st``. Specifically, I have observed the following issues when using the terminfo entries supplied with ``ncurses``: @@ -38,40 +38,53 @@ 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. +A couple of issues have been filed against ``tmux`` for this. Although it is +not a problem with ``tmux`` the issues remain for reference: + +| https://github.com/tmux/tmux/issues/1264 +| https://github.com/tmux/tmux/issues/1593 + +Complications +------------- + +While it may be tempting to use the terminfo files shipped with ``st``, that +would be a bad idea from a packaging standpoint. There are two reasons for +this: (1) As of ``st-0.8.2`` they have errors in them. This has been fixed and +will roll out in the next release, though. + +| https://lists.gnu.org/archive/html/bug-ncurses/2019-10/msg00071.html +| https://lists.suckless.org/hackers/1911/17006.html + +(2) It is vital that remote terminals connecting via ``ssh`` are known. That is +accomplished by having all terminfo files in one package (like ``ncurses``). + +``ncurses`` has released updated terminfo entries. The problem as described +above is fixed. However, the updated terminfo entries are not installed on +ArchLinux because they were released as a standalone file without a new release +of the rest of ``ncurses``. + 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 +The solution must be to get the updated terminfo entries packaged for +ArchLinux. I believe that the ``ncurses`` package should be updated to that +effect. -* ``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. +https://bugs.archlinux.org/task/57596 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: +above, can populate a user-level terminfo database from the terminfo entries +supplied by ``st``. The following command will do this: .. code:: shell - mkdir ~/.terminfo/s - ln -s /usr/share/st/terminfo/s/* ~/.terminfo/s + tic -sx /usr/share/st/st.info + +The generated terminfo database will most likely be placed in ``~/.terminfo``. +The command will print the actual location used. Unfortunately, these files +need to be kept up to date by hand. Actually they should probably be removed as +soon as a new version of ``ncurses`` is released. diff --git a/terminfo.patch b/terminfo.patch index e91e91f..0f2ae88 100644 --- a/terminfo.patch +++ b/terminfo.patch @@ -1,12 +1,25 @@ ---- Makefile 2019-02-09 12:50:41.000000000 +0100 -+++ Makefile 2019-10-30 23:39:55.775193275 +0100 -@@ -47,7 +47,8 @@ +--- Makefile.old 2019-02-09 12:50:41.000000000 +0100 ++++ Makefile 2019-11-07 00:00:24.487953923 +0100 +@@ -47,7 +47,6 @@ 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: +--- st.info.old 2019-02-09 12:50:41.000000000 +0100 ++++ st.info 2019-11-07 00:01:02.605412883 +0100 +@@ -189,10 +189,10 @@ + rmxx=\E[29m, + smxx=\E[9m, + # tmux extensions, see TERMINFO EXTENSIONS in tmux(1) +- Se, +- Ss, + Tc, + Ms=\E]52;%p1%s;%p2%s\007, ++ Se=\E[2 q, ++ Ss=\E[%p1%d q, + + st-256color| simpleterm with 256 colors, + use=st, From 0fe04350ef58e834d2032d326fc5908972df1904 Mon Sep 17 00:00:00 2001 From: "Sebastian J. Bronner" Date: Thu, 7 Nov 2019 00:23:53 +0100 Subject: [PATCH 4/4] Update .SRCINFO from last commit --- .SRCINFO | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/.SRCINFO b/.SRCINFO index 05aa389..d3b12ec 100644 --- a/.SRCINFO +++ b/.SRCINFO @@ -1,21 +1,19 @@ pkgbase = st pkgdesc = A simple virtual terminal emulator for X. pkgver = 0.8.2 - pkgrel = 9 + pkgrel = 10 url = https://st.suckless.org arch = i686 arch = x86_64 arch = armv7h license = MIT - makedepends = libxext - 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 + sha256sums = bf6c8b73a606a8e513c7919d91f93ed7aeb5f44e80269bb244cc01659145a5ea + sha256sums = 0ebcbba881832adf9c98ce9fe7667c851d3cc3345077cb8ebe32702698665be2 pkgname = st