On Fri, Nov 08, 2024 at 06:46:42PM +0100, Storkman wrote:
> On Thu, Nov 07, 2024 at 11:18:03AM +0000, stefan11111 wrote:
> > On 2024-11-05 10:37, stefan11111 wrote:
> > > 
> > > Looks like git st works.
> > 
> > Looked into it a bit more, and it turns out that the reason it failed 
> > like that
> > is not because of code from st, but because of the alpha patch for st.
> > 
> > XftColorAllocName() fails(likely not implemented in tinyx), which kills 
> > st.
> > 
> > Is there a way to get st to ignore/handle that error and not have it 
> > kill the app?
> 
> The alpha patch actually reverts the upstream fix. This part:
> 
> >     @@ -1118,11 +1127,23 @@ xinit(int cols, int rows)
> >             Window parent;
> >             pid_t thispid = getpid();
> >             XColor xmousefg, xmousebg;
> >     +       XWindowAttributes attr;
> >     +       XVisualInfo vis;
> >      
> >             if (!(xw.dpy = XOpenDisplay(NULL)))
> >                     die("can't open display\n");
> >             xw.scr = XDefaultScreen(xw.dpy);
> >     -       xw.vis = XDefaultVisual(xw.dpy, xw.scr);
> >     +
> >     +       if (!(opt_embed && (parent = strtol(opt_embed, NULL, 0)))) {
> >     +               parent = XRootWindow(xw.dpy, xw.scr);
> >     +               xw.depth = 32;
> >     +       } else {
> >     +               XGetWindowAttributes(xw.dpy, parent, &attr);
> >     +               xw.depth = attr.depth;
> >     +       }
> >     +
> >     +       XMatchVisualInfo(xw.dpy, xw.scr, xw.depth, TrueColor, &vis);
> >     +       xw.vis = vis.visual;
> >      
> >             /* font */
> >             if (!FcInit())
> >     @@ -1132,7 +1153,7 @@ xinit(int cols, int rows)
> >             xloadfonts(usedfont, 0);
> >      
> >             /* colors */
> >     -       xw.cmap = XDefaultColormap(xw.dpy, xw.scr);
> >     +       xw.cmap = XCreateColormap(xw.dpy, parent, xw.vis, None);
> >             xloadcols();
> 
> The depth is hard-coded to 32, which might not be supported,
> and the return value from XMatchVisualInfo() is not checked.
> If I run this on Xephyr with display depth set to 8-bit, st actually 
> segfaults.
> 
> You can see what display depth/class combinations are supported in the output
> of xdpyinfo.
> 
> > -- 
> > Linux-gentoo-x86_64-Intel-R-_Core-TM-_i5-7400_CPU_@_3.00GHz
> > 
> > COMMON_FLAGS="-O3 -pipe -march=native -fno-stack-check -fno-ident 
> > -fno-stack-protector -ftree-vectorize -ffast-math -funswitch-loops 
> > -fuse-linker-plugin -flto -fdevirtualize-at-ltrans -fno-plt 
> > -fno-semantic-interposition -falign-functions=64 -fgraphite-identity 
> > -floop-nest-optimize"
> > 
> > USE="-* git verify-sig rsync-verify man alsa X grub ipv6 ssl lto 
> > libressl olde-gentoo asm native-symlinks threads jit jumbo-build minimal 
> > strip system-man custom-cflags"
> > 
> > INSTALL_MASK="/etc/systemd /lib/systemd /usr/lib/systemd 
> > /usr/lib/modules-load.d /usr/lib/tmpfiles.d /var/lib/dbus /lib/udev"
> > 
> > How to fix gcc 14:
> > 
> > diff --git a/gcc/c-family/c-opts.cc.bak b/gcc/c-family/c-opts.cc
> > index f4dced8..0e12ac0 100644
> > --- a/gcc/c-family/c-opts.cc
> > +++ b/gcc/c-family/c-opts.cc
> > @@ -861,8 +861,6 @@ c_common_post_options (const char **pfilename)
> >        reject certain GNU extensions also present the defaults for later
> >        language modes.  */
> >     if (!c_dialect_cxx ()
> > -      && !flag_isoc99
> > -      && !global_dc->m_pedantic_errors
> >         && !OPTION_SET_P (flag_permissive))
> >       {
> >         flag_permissive = 1;
> > 
> 
> -- 
> Storkman
> 

Maybe some workaround using XSetErrorHandler() (like dwm does) could work.

I haven't tested st on older systems or <24-bit displays recently, but upstream
patches to support them are welcome.

Thanks,

-- 
Kind regards,
Hiltjo

Reply via email to