[Bug 284976] x11/sterm: Xresources patch is incorrect

From: <bugzilla-noreply_at_freebsd.org>
Date: Sun, 23 Feb 2025 08:16:47 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=284976

            Bug ID: 284976
           Summary: x11/sterm: Xresources patch is incorrect
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: Individual Port(s)
          Assignee: pkubaj@FreeBSD.org
          Reporter: alexey@ocaml.nl
          Assignee: pkubaj@FreeBSD.org
             Flags: maintainer-feedback?(pkubaj@FreeBSD.org)

Unfortunately, I did not find how to report a bug upstream, so I am reporting
it here.

The x11/sterm port has an XRESOURCES option, which fetches and applies the
patch to the st source code for support of X resources. Unfortunately, the
patch is wrong and does not work. The culprit is the following:

the patch adds, besides other things, to config.def.h the following three
lines:

{ "background",   STRING,  &colorname[256] },
{ "foreground",   STRING,  &colorname[257] },
{ "cursorColor",  STRING,  &colorname[258] },

Unfortunately, this is wrong. The lines should be

{ "background",   STRING,  &colorname[259] },
{ "foreground",   STRING,  &colorname[258] },
{ "cursorColor",  STRING,  &colorname[256] },

due to the following settings in the code:

unsigned int defaultfg = 258;
unsigned int defaultbg = 259;
unsigned int defaultcs = 256;

So, with the patch as is, background, foreground, and cursor color X resources
are successfully read but overwrite the wrong entries in the colorname[] table.

I have rebuilt st locally with my changes, and now X resources work as
expected.

-- 
You are receiving this mail because:
You are the assignee for the bug.