On Fri, Aug 05, 2022 at 03:36:44PM +0200, Matthieu Herrb wrote:
> On Thu, Aug 04, 2022 at 04:42:57PM +0200, Walter Alejandro Iglesias wrote:
> > Run xterm with the default system Xresources, open the "VT Fonts" dialog
> > (holding down Ctrl and pressing right mouse button) check TrueType
> > Fonts.  At least to me, fontconfig writes the following error:
> > 
> >   $ xterm
> >   Fontconfig error: Cannot load default config file: No such file:
> >   (null)
> 
> Ok I understood this problem. It's caused by the fact that xterm is
> accessing /etc/fonts after it's initialization, once unveil() has
> entered into action.
> 
> One possible patch is to add /etc/fonts to the unveiled directories :
> 
> Index: app/xterm/main.c
> ===================================================================
> RCS file: /cvs/OpenBSD/xenocara/app/xterm/main.c,v
> retrieving revision 1.57
> diff -u -p -u -r1.57 main.c
> --- app/xterm/main.c  22 May 2022 14:43:01 -0000      1.57
> +++ app/xterm/main.c  5 Aug 2022 13:31:15 -0000
> @@ -2968,6 +2968,7 @@ main(int argc, char *argv[]ENVP_ARG)
>           }
>  
>           unveil("/usr/X11R6", "r");
> +         unveil("/etc/fonts", "r");
>              unveil("/usr/local/share/fonts", "r");
>           unveil("/var/cache/fontconfig", "r");
>           unveil("/usr/local/share/icons", "r");


I compiled xterm with your patch.  With default settings xterm shows no
error and the font selected is loaded correctly, and this is a detail I
forgot to mention: before your patch, besides the error, the selected
Xft font wasn't loaded.

But your patch solves the problem partially.  Let me explain my point,
exactly because I don't like to modify system files and because at some
point I got tired of freedesktop "innovations" and to find out what
every Linux distribution or BSD system did in /etc/fonts, decades ago I
decided to set FONTCONFIG_FILE variable to point to my ~/.fonts.conf
(more late to ~/.config/fontsconfig/fonts.conf).  And I did something
alike with all desktop related config files.  Fonts and icons I need are
in my home dir too.  In that way just untaring my home directory I got
my environment behaving in the way I wanted in any unix-like system.

Now, after applying your patch, setting FONTCONFIG_FILE and
FONTCONFIG_PATH to my home config dir and file, xterm loads the xft font
correctly but the error appears again.  I don't understand why since it
seemed to me to see in the code (main.c) that home directory as well as
the xdg direcories are also unveiled.

> 
> -- 
> Matthieu Herrb


  Walter

Reply via email to