Hello,

Am 05.07.2026 um 15:16 schrieb atrent:
Package: apt-dater
Version: 1.0.4+git20260113-1
Severity: important
X-Debbugs-Cc: [email protected]

Dear Maintainer,

After a recent upgrade of tmux apt-dater started (when connecting to a host) 
failing with errors like:

"invalid window name: user,,, # root@host...." (username and host are edited)

Latest versions of tmux have restricted characters allowed in window titles 
(see tmux/tmux#5299) so apt-dater fails

I did not find a way of setting a title in the config file of apt-dater...

Actually the code seems to set a title without resorting to the config file 
(see line 174 of src/tmux.c) if I understand correctly (I'm not a C expert).

Apart from editing the src and recompiling, what is your advice?

(I also submitted the same message to the issues on apt-dater repository, see 
https://github.com/DE-IBH/apt-dater/issues/188)

Thank you

Could you test the attached patch?

Index: debian/changelog
===================================================================
--- debian/changelog    (Revision 11685)
+++ debian/changelog    (Arbeitskopie)
@@ -1,6 +1,8 @@
 apt-dater (1.0.4+git20260113-2) UNRELEASED; urgency=medium
 
   * Update debian/watch to version 5.
+  * Add patch 04-tmux-window-name to fix a problem with newer tmux versions.
+    Closes: #1141491
 
  -- Patrick Matthäi <[email protected]>  Wed, 28 Jan 2026 14:38:56 +0100
 
Index: debian/patches/04-tmux-window-name.diff
===================================================================
--- debian/patches/04-tmux-window-name.diff     (nicht existent)
+++ debian/patches/04-tmux-window-name.diff     (Arbeitskopie)
@@ -0,0 +1,54 @@
+Description: tmux: sanitize generated window name to satisfy modern tmux
+ apt-dater builds the tmux window name from a hard-coded format
+ ("%m # %U%H"), producing names such as
+ "Maintainer # [email protected]:22".
+ .
+ Recent tmux releases restrict the characters permitted in window (and
+ session) names and abort with "invalid window name: ..." when the name
+ contains ':', '.' or '#', or control characters. Additionally '#' is
+ subject to tmux format expansion. As a result apt-dater can no longer
+ open a session on any host once such a tmux is installed.
+Author: Patrick Matthäi <[email protected]>
+Bug: https://github.com/DE-IBH/apt-dater/issues/188
+Bug-Debian: https://bugs.debian.org/1141491
+Origin: upstream, https://github.com/tmux/tmux/issues/5299
+Forwarded: no
+Last-Update: 2026-07-08
+---
+--- a/src/tmux.c
++++ b/src/tmux.c
+@@ -168,10 +168,33 @@ tmux_get_sessions(HostNode *n) {
+   return g_list_length(n->screens) > 0;
+ }
+ 
++/*
++ * Recent tmux releases (see https://github.com/tmux/tmux/issues/5299)
++ * reject window names that contain ':', '.' or '#' as well as control
++ * characters, aborting with "invalid window name: ...". The '#' is also
++ * subject to tmux format expansion. As the window name is purely
++ * cosmetic (sessions are identified by their numeric name/PID), replace
++ * every such character with an underscore so the generated name is
++ * always accepted, regardless of the installed tmux version.
++ */
++static gchar *
++tmux_sanitize_name(gchar *name) {
++  if (!name)
++    return name;
++
++  for (gchar *p = name; *p != '\0'; p++) {
++    if (*p == ':' || *p == '.' || *p == '#' ||
++      (guchar) *p < 0x20 || (guchar) *p == 0x7f)
++      *p = '_';
++  }
++
++  return name;
++}
++
+ gchar **
+ tmux_new(HostNode *n, const gboolean detached) {
+   gchar **_argv = (gchar **) g_malloc0(sizeof(gchar *) * 9);
+-  gchar *title = parse_string("%m # %U%H", n);
++  gchar *title = tmux_sanitize_name(parse_string("%m # %U%H", n));
+ 
+   _argv[0] = g_strdup(TMUX_BINARY);
+   _argv[1] = g_strdup("-S");
Index: debian/patches/series
===================================================================
--- debian/patches/series       (Revision 11685)
+++ debian/patches/series       (Arbeitskopie)
@@ -1,3 +1,4 @@
 01-tmux-options.diff
 02-gcc-15.diff
 03-display-hosts.diff
+04-tmux-window-name.diff

Reply via email to