edge/main/mc: various timeouts encountered during usage with ncurses
Using mc
on Alpine (edge), I've encountered timeouts while doing simple things like alt-p
and alt-n
for moving around in command history. There are also timeouts when leaving the built-in editor as well as the viewer, plus other various normal usages.
The following strace will show the alt-p
timeout.
select(6, [0 5], NULL, NULL, NULL) = 1 (in [0]) <4.021007>
rt_sigaction(SIGINT, {sa_handler=SIG_IGN, sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=0x7f1d6fdfac4b}, NULL, 8) = 0 <0.000006>
select(6, [0 5], NULL, NULL, NULL) = 1 (in [0]) <0.000005>
read(0, "\33", 1) = 1 <0.000005>
poll([{fd=0, events=POLLIN}], 1, 200) = 1 ([{fd=0, revents=POLLIN}]) <0.000004>
read(0, "p", 1) = 1 <0.000003>
# TIMEOUT: 1.001324 #######################################################################
select(1, [0], NULL, NULL, {tv_sec=1, tv_usec=0}) = 0 (Timeout) <1.001324>
###########################################################################################
select(4, [3], NULL, NULL, {tv_sec=0, tv_usec=0}) = 0 (Timeout) <0.000021>
select(1, [0], NULL, NULL, {tv_sec=0, tv_usec=0}) = 0 (Timeout) <0.000006>
select(1, [0], NULL, NULL, {tv_sec=0, tv_usec=0}) = 0 (Timeout) <0.000003>
select(4, [3], NULL, NULL, {tv_sec=0, tv_usec=0}) = 0 (Timeout) <0.000003>
rt_sigaction(SIGTSTP, {sa_handler=SIG_IGN, sa_mask=[], sa_flags=SA_RESTORER|SA_RESTART, sa_restorer=0x7f1d6fdfac4b}, {sa_handler=0x7f1d6fd7dece, sa_mask=[], sa_flags=SA_RESTORER|SA_RESTART, sa_restorer=0x7f1d6fdfac4b}, 8) = 0 <0.000003>
poll([{fd=0, events=POLLIN}], 1, 0) = 0 (Timeout) <0.000004>
poll([{fd=0, events=POLLIN}], 1, 0) = 0 (Timeout) <0.000003>
write(1, "\33[58;64Hhecksum "..., 41) = 41 <0.000014>
rt_sigaction(SIGTSTP, {sa_handler=0x7f1d6fd7dece, sa_mask=[], sa_flags=SA_RESTORER|SA_RESTART, sa_restorer=0x7f1d6fdfac4b}, NULL, 8) = 0 <0.000003>
rt_sigaction(SIGTSTP, {sa_handler=SIG_IGN, sa_mask=[], sa_flags=SA_RESTORER|SA_RESTART, sa_restorer=0x7f1d6fdfac4b}, {sa_handler=0x7f1d6fd7dece, sa_mask=[], sa_flags=SA_RESTORER|SA_RESTART, sa_restorer=0x7f1d6fdfac4b}, 8) = 0 <0.000003>
poll([{fd=0, events=POLLIN}], 1, 0) = 0 (Timeout) <0.000003>
poll([{fd=0, events=POLLIN}], 1, 0) = 0 (Timeout) <0.000003>
rt_sigaction(SIGTSTP, {sa_handler=0x7f1d6fd7dece, sa_mask=[], sa_flags=SA_RESTORER|SA_RESTART, sa_restorer=0x7f1d6fdfac4b}, NULL, 8) = 0 <0.000003>
select(4, [3], NULL, NULL, {tv_sec=0, tv_usec=0}) = 0 (Timeout) <0.000004>
rt_sigaction(SIGINT, {sa_handler=0x5608184a53bc, sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=0x7f1d6fdfac4b}, NULL, 8) = 0 <0.000003>
select(6, [0 5], NULL, NULL, NULL <detached ...>
I've used mc for years on Gentoo and I've always linked it against the slang
libraries instead of ncurses
. I felt like this was a ncurses
issue so I copied out main/mc into my testing/mc build arena. After building and installing the new mc + slang
version, all of the annoying timeout delays were fixed.
Here is the mc + slang
strace.
select(7, [3 6], NULL, NULL, NULL) = 1 (in [3]) <3.765956>
rt_sigaction(SIGINT, {sa_handler=SIG_IGN, sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=0x7f0b5cd1ec4b}, NULL, 8) = 0 <0.000005>
select(7, [3 6], NULL, NULL, NULL) = 1 (in [3]) <0.000014>
select(4, [3], NULL, NULL, {tv_sec=10, tv_usec=0}) = 1 (in [3], left {tv_sec=9, tv_usec=999999}) <0.000005>
read(3, "\33", 1) = 1 <0.000005>
# TIMEOUT: 0.000069 #######################################################################
select(4, [3], NULL, NULL, {tv_sec=1, tv_usec=0}) = 1 (in [3], left {tv_sec=0, tv_usec=999999}) <0.000069>
###########################################################################################
select(4, [3], NULL, NULL, {tv_sec=0, tv_usec=0}) = 1 (in [3], left {tv_sec=0, tv_usec=0}) <0.000004>
select(4, [3], NULL, NULL, {tv_sec=10, tv_usec=0}) = 1 (in [3], left {tv_sec=9, tv_usec=999999}) <0.000004>
read(3, "p", 1) = 1 <0.000004>
select(5, [4], NULL, NULL, {tv_sec=0, tv_usec=0}) = 0 (Timeout) <0.000004>
select(4, [3], NULL, NULL, {tv_sec=0, tv_usec=0}) = 0 (Timeout) <0.000003>
select(4, [3], NULL, NULL, {tv_sec=0, tv_usec=0}) = 0 (Timeout) <0.000003>
select(5, [4], NULL, NULL, {tv_sec=0, tv_usec=0}) = 0 (Timeout) <0.000003>
write(1, "\33[58;56Habuild checksum\33[87C\33[58"..., 36) = 36 <0.000008>
select(5, [4], NULL, NULL, {tv_sec=0, tv_usec=0}) = 0 (Timeout) <0.000003>
rt_sigaction(SIGINT, {sa_handler=0x55acf26aff43, sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=0x7f0b5cd1ec4b}, NULL, 8) = 0 <0.000003>
select(7, [3 6], NULL, NULL, NULL <detached ...>
So far, mc + slang
is incredibly fast and responsive.
As an aside, the same behavior is also in Alpine Linux v3.13.
Below is the patch I used to switch mc
from using ncurses
==> slang
.
--- APKBUILD 2021-04-28 14:40:27.006666699 -0700
+++ /home/fqdevel/devel/alpine/fq/testing/mc/APKBUILD 2021-05-03 04:04:20.126666592 -0700
@@ -2,13 +2,14 @@
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=mc
pkgver=4.8.26
-pkgrel=0
+pkgrel=1
pkgdesc="Filemanager/shell that emulates Norton Commander"
url="https://www.midnight-commander.org"
arch="all"
license="GPL-3.0-or-later"
subpackages="$pkgname-doc $pkgname-lang"
-makedepends="e2fsprogs-dev glib-dev libssh2-dev ncurses-dev perl"
+depends="slang"
+makedepends="e2fsprogs-dev glib-dev libssh2-dev slang-dev perl"
source="https://www.midnight-commander.org/downloads/mc-$pkgver.tar.xz
fix-cchar_t.patch
alpine_syntax.patch"
@@ -28,7 +29,7 @@
--enable-vfs-sftp \
--with-internal-edit \
--with-mmap \
- --with-screen=ncurses \
+ --with-screen=slang \
--with-subshell \
--without-gpm-mouse \
--without-included-gettext \
If it is approved to move from ncurses
to slang
, would you like for me to create a merge request?
Thank you for your consideration.