Control: forwarded -1 https://github.com/xo/terminfo/pull/3
Control: tags -1 + patch

On 2026-08-03 18:28 +0200, Sven Joachim wrote:

> Package: terminfo
> Version: 0.0~git20220910.abceb7e-2
> Severity: important
>
> The go-infocmp program does not handle terminfo entries larger than 4096
> bytes.  This is a problem since many xterm* entries are now larger than
> that limit.
>
> ,----
> | $ go-infocmp -term xterm
> | 2026/08/03 18:19:18 invalid file size
> | $ go-infocmp -term xterm-256color
> | 2026/08/03 18:19:26 invalid file size
> | $ stat -c '%s %n' /usr/share/terminfo/x/xterm{,-256color}
> | 4156 /usr/share/terminfo/x/xterm
> | 4242 /usr/share/terminfo/x/xterm-256color
> `----
>
> The remedy is likely to increase maxFileLength to 32768 in dec.go, but I
> have not tested that.  Note that the limit has been raised to 32768
> bytes since ncurses 6.1 (released 2018), but only this year have popular
> terminfo entries started to exceed the previous limit of 4096 bytes.

The attached patch works for me, and I have sent a pull request
upstream.  There has been no activity there for nearly four years,
though.

Cheers,
       Sven

From f66a01d8e789b33e1941d3a1f1470b4fbf916e57 Mon Sep 17 00:00:00 2001
From: Sven Joachim <[email protected]>
Date: Mon, 10 Aug 2026 18:00:40 +0200
Subject: [PATCH 1/1] Bump maximum file length to 32768

This has been the limit since ncurses 6.1.  In recent ncurses
patchlevels several popular entries like xterm and xterm-256color have
started to exceed the previous limit of 4096, causing infocmp to fail.
---
 dec.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/dec.go b/dec.go
index dacc88e..f650c2d 100644
--- a/dec.go
+++ b/dec.go
@@ -6,7 +6,7 @@ import (
 
 const (
 	// maxFileLength is the max file length.
-	maxFileLength = 4096
+	maxFileLength = 32768
 	// magic is the file magic for terminfo files.
 	magic = 0o432
 	// magicExtended is the file magic for terminfo files with the extended
-- 
2.55.0

Reply via email to