Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 926608 - x11-terms/rxvt-unicode: Resizing the terminal creates weird garbage when running tmux
Summary: x11-terms/rxvt-unicode: Resizing the terminal creates weird garbage when runn...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Marek Szuba
URL:
Whiteboard:
Keywords:
: 933173 (view as bug list)
Depends on:
Blocks:
 
Reported: 2024-03-09 17:38 UTC by aapo.vienamo
Modified: 2024-06-03 14:43 UTC (History)
5 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description aapo.vienamo 2024-03-09 17:38:59 UTC
I kept seeing garbage like 10;rgb:ff00/ff00/ff0011;rgb:1200/1200/1200 on the input line in tmux after resizing the terminal or attaching to a tmux session (over ssh running on an OpenBSD host). I found that the issue had been reported to tmux, but apparently it's an issue with rxvt-unicode: https://github.com/tmux/tmux/issues/3470

Reproducible: Always

Steps to Reproduce:
1. SSH into a system that is running the openbsd-7.4 version of tmux
2. Start tmux
3. Resize the terminal or detach and reattach the tmux session
Actual Results:  
Spurious input like  10;rgb:ff00/ff00/ff0011;rgb:1200/1200/1200 appears.

Expected Results:  
No change on the shell prompt or other input to the program running in tmux

The GitHub issue has a link to a patch to rxvt-unicode: https://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/ports/x11/rxvt-unicode/patches/patch-src_command_C?rev=1.6&content-type=text/plain

Here's the version of the patch I'm running locally that fixes the issue:
OSC commands returning the colour sequence must be terminated by either
of ST, ESC \, or BEL. rxvt-unicode tries to use the same type of termination
as was in the query but doesn't correctly handle the multiple-char sequence
used for 7-bit queries. Force to using ESC \ instead for now.

Index: src/command.C
--- a/src/command.C
+++ b/src/command.C
@@ -3426,9 +3426,9 @@ rxvt_term::process_color_seq (int report, int color, c
         snprintf (rgba_str, sizeof (rgba_str), "rgb:%04x/%04x/%04x", c.r, c.g, c.b);
 
       if (IN_RANGE_INC (color, minCOLOR, maxTermCOLOR))
-        tt_printf ("\033]%d;%d;%s%c", report, color - minCOLOR, rgba_str, resp);
+        tt_printf ("\033]%d;%d;%s\033\\", report, color - minCOLOR, rgba_str);
       else
-        tt_printf ("\033]%d;%s%c", report, rgba_str, resp);
+        tt_printf ("\033]%d;%s\033\\", report, rgba_str, resp);
     }
   else
     set_window_color (color, str);


emerge --info:
Portage 3.0.61 (python 3.11.8-final-0, default/linux/amd64/17.1/systemd/merged-usr, gcc-13, glibc-2.38-r10, 6.6.13-gentoo x86_64)
=================================================================
System uname: Linux-6.6.13-gentoo-x86_64-AMD_Ryzen_9_7950X_16-Core_Processor-with-glibc2.38
KiB Mem:    98602696 total,  83718216 free
KiB Swap:    8392700 total,   8392700 free
Timestamp of repository gentoo: Sat, 09 Mar 2024 11:00:00 +0000
Head commit of repository gentoo: 3bdf8d1bf7a753f7367a8274ec90026b47d34889
Timestamp of repository haskell: Fri, 08 Mar 2024 06:20:27 +0000
Head commit of repository haskell: 281ecc20276c1a36789e67c6269482280c5e29a7

sh bash 5.1_p16-r6
ld GNU ld (Gentoo 2.41 p5) 2.41.0
distcc 3.4 x86_64-pc-linux-gnu [disabled]
ccache version 4.9.1 [disabled]
app-misc/pax-utils:        1.3.7::gentoo
app-shells/bash:           5.1_p16-r6::gentoo
dev-build/autoconf:        2.13-r8::gentoo, 2.71-r6::gentoo
dev-build/automake:        1.16.5-r2::gentoo
dev-build/cmake:           3.27.9::gentoo
dev-build/libtool:         2.4.7-r2::gentoo
dev-build/make:            4.4.1-r1::gentoo
dev-build/meson:           1.3.1-r1::gentoo
dev-java/java-config:      2.3.3-r1::gentoo
dev-lang/perl:             5.38.2-r2::gentoo
dev-lang/python:           2.7.18_p16-r2::gentoo, 3.10.13_p3::gentoo, 3.11.8_p1::gentoo, 3.12.2_p1::gentoo
dev-lang/rust:             1.76.0::gentoo
dev-lang/rust-bin:         1.74.1::gentoo
dev-util/ccache:           4.9.1::gentoo
sys-apps/baselayout:       2.14-r2::gentoo
sys-apps/sandbox:          2.38::gentoo
sys-apps/systemd:          255.3-r1::gentoo
sys-devel/binutils:        2.41-r5::gentoo
sys-devel/binutils-config: 5.5::gentoo
sys-devel/clang:           17.0.6::gentoo
sys-devel/gcc:             13.2.1_p20240210::gentoo
sys-devel/gcc-config:      2.11::gentoo
sys-devel/lld:             17.0.6::gentoo
sys-devel/llvm:            17.0.6::gentoo
sys-kernel/linux-headers:  6.6::gentoo (virtual/os-headers)
sys-libs/glibc:            2.38-r10::gentoo
Repositories:

gentoo
    location: /usr/portage
    sync-type: rsync
    sync-uri: rsync://rsync.gentoo.org/gentoo-portage
    priority: -1000
    volatile: True
    sync-rsync-verify-max-age: 3
    sync-rsync-extra-opts: 
    sync-rsync-verify-metamanifest: yes
    sync-rsync-verify-jobs: 1

crossdev
    location: /usr/local/portage
    masters: gentoo haskell
    priority: 0
    volatile: True

haskell
    location: /var/db/repos/haskell
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/haskell.git
    masters: gentoo
    volatile: False

ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="@FREE RAR freedist MSttfEULA D1X Spotify BUILDLIC HRP free-noncomm NVIDIA-r1 linux-firmware lablgtk-examples AIFFWriter.m quake1-demodata DUKE3D no-source-code xgraph netperf lha NVIDIA-r2 Snes9x dgen-sdl CC-Sampling-Plus-1.0 linux-fw-redistributable"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=native -O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/lib64/libreoffice/program/sofficerc /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-march=native -O2 -pipe"
DISTDIR="/usr/portage/distfiles"
ENV_UNSET="CARGO_HOME DBUS_SESSION_BUS_ADDRESS DISPLAY GDK_PIXBUF_MODULE_FILE GOBIN GOPATH PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR XDG_STATE_HOME"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs buildpkg-live config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync multilib-strict network-sandbox news parallel-fetch pid-sandbox pkgdir-index-trusted preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
INSTALL_MASK="/usr/share/cursors/xorg-x11/Adwaita"
LANG="en_US.utf8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LEX="flex"
LINGUAS=" fi ja en en_GB en_US sv sv_SE"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
PORTAGE_TMPDIR="/var/tmp"
SHELL="/bin/zsh"
USE="X aac acl alsa amd64 ao bindist bluetooth bzip2 cairo cddb cdparanoia cli corefonts cpudetection crossdev crypt cryptsetup cuda cups d3d9 dri dssi egl exif ffmpeg flac fontconfig fortran ftdi ftp gdbm gif h264 iconv id3tag ieee1394 ipv6 jack jpeg jpeg2k ladspa libcaca libsamplerate libtirpc lto lzma lzo m3u mad mikmod mod modplug mp3 mpeg mpeg2 multilib ncurses nls ntp nvenc offensive ogg openal opengl openmp opus pam pcre pgo pipewire png postscript qt6 readline rtmp seccomp sixel smp speex ssl svg systemd test-rust theora threads tiff tremor truetype twolame udev unicode v4l vaapi vdpau vim-syntax vorbis vst vulkan wayland webp x264 x265 xattr xcb xft xinerama xvid zlib zsh-completion zstd" ABI_X86="32 64" ADA_TARGET="gnat_2021" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_anon authn_dbm authn_file authz_dbm authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir env expires ext_filter file_cache filter headers include info log_config logio mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="karbon sheets words" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="aes avx avx2 avx512f avx512dq avx512cd avx512bw avx512vl avx512vbmi f16c fma3 mmx mmxext pclmul popcnt rdrand sha sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock greis isync itrax mtk3301 ntrip navcom oceanserver oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 tsip tripmate tnt ublox" INPUT_DEVICES="libinput" KERNEL="linux" L10N="en en-GB fi ja sv" LCD_DEVICES="bayrad cfontz glk hd44780 lb216 lcdm001 mtxorb text" LLVM_TARGETS="AArch64 ARM BPF WebAssembly X86" LUA_SINGLE_TARGET="lua5-1" LUA_TARGETS="lua5-1" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php8-1" POSTGRES_TARGETS="postgres15" PYTHON_SINGLE_TARGET="python3_11" PYTHON_TARGETS="python3_7 python3_8 python3_10 python3_11" RUBY_TARGETS="ruby26 ruby31" VIDEO_CARDS="nvidia" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipp2p iface geoip fuzzy condition tarpit sysrq proto logmark ipmark dhcpmac delude chaos account"
Unset:  ADDR2LINE, AR, ARFLAGS, AS, ASFLAGS, CC, CCLD, CONFIG_SHELL, CPP, CPPFLAGS, CTARGET, CXX, CXXFILT, ELFEDIT, EMERGE_DEFAULT_OPTS, EXTRA_ECONF, F77FLAGS, FC, GCOV, GPROF, LC_ALL, LD, LFLAGS, LIBTOOL, MAKE, MAKEFLAGS, MAKEOPTS, NM, OBJCOPY, OBJDUMP, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, PYTHONPATH, RANLIB, READELF, RUSTFLAGS, SIZE, STRINGS, STRIP, YACC, YFLAGS
Comment 1 aapo.vienamo 2024-03-09 18:14:47 UTC
Forgot to add that rxvt-unicode version was x11-terms/rxvt-unicode-9.31-r2
Comment 2 Larry the Git Cow gentoo-dev 2024-04-24 12:58:33 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=83e9a0ee39f4b29e79fe31dd6cf4effd83f405ad

commit 83e9a0ee39f4b29e79fe31dd6cf4effd83f405ad
Author:     Marek Szuba <marecki@gentoo.org>
AuthorDate: 2024-04-24 12:56:57 +0000
Commit:     Marek Szuba <marecki@gentoo.org>
CommitDate: 2024-04-24 12:58:22 +0000

    x11-terms/rxvt-unicode: work around incorrect handling of OSC commands returning colour sequences
    
    Closes: https://bugs.gentoo.org/926608
    Signed-off-by: Marek Szuba <marecki@gentoo.org>

 ...icode-9.31-osc-colour-command-termination.patch |  19 ++++
 x11-terms/rxvt-unicode/rxvt-unicode-9.31-r3.ebuild | 126 +++++++++++++++++++++
 2 files changed, 145 insertions(+)
Comment 3 Marek Szuba (RETIRED) archtester gentoo-dev 2024-06-03 14:43:28 UTC
*** Bug 933173 has been marked as a duplicate of this bug. ***