Bug 1106850

Summary: xfig crashes if noto-sans-cjk-fonts are installed
Product: [openSUSE] openSUSE Distribution Reporter: Giacomo Comes <comes>
Component: X.OrgAssignee: Stefan Dirsch <sndirsch>
Status: RESOLVED FIXED QA Contact: E-mail List <xorg-maintainer-bugs>
Severity: Normal    
Priority: P3 - Medium CC: comes, jnweiger, pgajdos, skliu, sndirsch, stefan.bruens, thomas.schraitle, werner
Version: Leap 15.0   
Target Milestone: ---   
Hardware: Other   
OS: Other   
Whiteboard:
Found By: --- Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---

Description Giacomo Comes 2018-09-03 04:32:04 UTC
After I install the fonts noto-sans-cjk-fonts, when I start xfig I got these warnings in the terminal:

Warning: Missing charsets in String to FontSet conversion
Warning: Cannot convert string "-URW-Nimbus Roman No9 L-medium-r-normal--34-*-*-*-*-*-*-*,-kochi-mincho-medium-r-normal--34-*-*-*-*-*-jisx0208.1983-0,-baekmukttf-batang-medium-r-normal--34-*-*-*-*-*-ksc5601.1987-0,-*-times-medium-r-normal--34-*-*-*-*-*-*-*,-*-*-medium-r-normal--34-*-*-*-*-*-*-*,*--34-*-*-times-medium-r-normal--16-*-*-*-*-*-*-*,-*-*-medium-r-normal--16-*-*-*-*-*-*-*,*--16-*" to type FontSet
Warning: Missing charsets in String to FontSet conversion
Warning: Unable to load any usable fontset
Warning: Missing charsets in String to FontSet conversion
Warning: Unable to load any usable fontset

and when I select File->Open (or Merge or Save As or Export) xfig crashes and print this error message:

Error: Aborting: no fontset found

If I remove all the noto-sans-cjk-fonts, then xfig works again.

Whatever is causing the problem apparently it got fixed in tumbleweed (xfig works fine also with noto-sans-cjk-fonts installed). It would be good to apply the fix to 15.0 too.
Comment 1 Dr. Werner Fink 2018-09-03 11:22:21 UTC
Hmmm ... interesting .... AFAICS there is no difference between Leap 15 and Tumbleweed version of xfig

 /suse/werner> osc rdiff openSUSE:Leap:15.0 xfig openSUSE:Factory xfig
 /suse/werner> osc ls -l openSUSE:Factory xfig
 11dd366985b85d359633eef07bca2c10      47      2529 Jan 15  2007 font-test.fig
 61a2a64d187977e948f0bbc124e1520e      47      2388 Sep 23  2016 xfig-3.2.6.dif
 501d72a0b091a52ad4699abeed98edc9      47   5067004 May 07 07:56 xfig-3.2.7a.tar.xz
 86420bdb4f85802319e589268797044c      47      2315 Sep 22  2016 xfig.3.2.3d-international-std-fonts.dif
 3475b233b2a880eddf3be47b16f825fc      47      5653 May 07 07:56 xfig.3.2.5-urw-fonts.dif
 b4fa6c78479782e12e6319c18002fd30      47       602 Sep 22  2016 xfig.3.2.5-xim.dif
 bb19a5581e501c72b1abb39bb9c2a268      47      1926 Sep 22  2016 xfig.3.2.5b-fixes.dif
 033cd37e199ab4a3dba4d8ddbc284838      47      1766 May 07 07:56 xfig.3.2.5b-locale.dif
 594b8740b65603dbcc629585f0eec21d      47      1531 Sep 22  2016 xfig.3.2.5b-null.dif
 ecb04afc4f7ecc64864f5dae30c21701      47      1103 Sep 22  2016 xfig.3.2.5b-preview.dif
 42fc796f4f1fab49c3f5ac03ae2a34a4      47       750 May 07 07:56 xfig.3.2.5b-pspdftex.dif
 b86a5b09d850b27ef39505a0d6784a3b      47     46222 May 07 07:56 xfig.changes
 57414a87479383b382a4742753dc1778      47       185 Dec 10  2013 xfig.desktop
 366dc32d558d2d6d7ce3b81ef4c0b626      47       427 Nov 18  2014 xfig.sh
 5862dab7179d6fbfdc1ceb4dbb416841      47      5732 May 07 07:56 xfig.spec
 /suse/werner> osc ls -l openSUSE:Leap:15.0 xfig
 11dd366985b85d359633eef07bca2c10       3      2529 Jan 15  2007 font-test.fig
 61a2a64d187977e948f0bbc124e1520e       3      2388 Sep 23  2016 xfig-3.2.6.dif
 501d72a0b091a52ad4699abeed98edc9       3   5067004 May 07 07:56 xfig-3.2.7a.tar.xz
 86420bdb4f85802319e589268797044c       3      2315 Sep 22  2016 xfig.3.2.3d-international-std-fonts.dif
 3475b233b2a880eddf3be47b16f825fc       3      5653 May 07 07:56 xfig.3.2.5-urw-fonts.dif
 b4fa6c78479782e12e6319c18002fd30       3       602 Sep 22  2016 xfig.3.2.5-xim.dif
 bb19a5581e501c72b1abb39bb9c2a268       3      1926 Sep 22  2016 xfig.3.2.5b-fixes.dif
 033cd37e199ab4a3dba4d8ddbc284838       3      1766 May 07 07:56 xfig.3.2.5b-locale.dif
 594b8740b65603dbcc629585f0eec21d       3      1531 Sep 22  2016 xfig.3.2.5b-null.dif
 ecb04afc4f7ecc64864f5dae30c21701       3      1103 Sep 22  2016 xfig.3.2.5b-preview.dif
 42fc796f4f1fab49c3f5ac03ae2a34a4       3       750 May 07 07:56 xfig.3.2.5b-pspdftex.dif
 b86a5b09d850b27ef39505a0d6784a3b       3     46222 May 07 07:56 xfig.changes
 57414a87479383b382a4742753dc1778       3       185 Dec 10  2013 xfig.desktop
 366dc32d558d2d6d7ce3b81ef4c0b626       3       427 Nov 18  2014 xfig.sh
 5862dab7179d6fbfdc1ceb4dbb416841       3      5732 May 07 07:56 xfig.spec

the same seems to be true for the package (google-)noto-sans-cjk-fonts on Tumbleweed as well as on Leap 15
Comment 2 Dr. Werner Fink 2018-09-03 11:26:46 UTC
@ Stefan ... had there been some changes in fontset/fontconfig API since Leap/SLES 15 and current Tumbleweed?
Comment 3 Dr. Werner Fink 2018-09-03 11:32:59 UTC
Hmmm ... can not reproduce, just installed noto-sans-cjk-fonts and (as expanded by zypper) also noto-sans-jp-bold-fonts noto-sans-jp-fonts noto-sans-jp-regular-fonts noto-sans-kr-bold-fonts noto-sans-kr-fonts noto-sans-kr-regular-fonts noto-sans-sc-bold-fonts noto-sans-sc-fonts noto-sans-sc-regular-fonts noto-sans-tc-bold-fonts noto-sans-tc-fonts noto-sans-tc-regular-fonts

and started xfig ... it starts and stays here ...

Please show you locale settings (output of the program locale) as well as your ~/.fonts.conf if you have one
Comment 4 Dr. Werner Fink 2018-09-03 11:53:20 UTC
... and value of the environment variable XMODIFIERS as shown by

   echo $XMODIFIERS

would be very interesting ... also the values of font config environment variables as shown by

   echo ${!FONTCONFIG_*} ${!FC_*}

which would be something like

   for var in ${!FONTCONFIG_*} ${!FC_*}; do
       eval echo $var=\$$var
   done
Comment 5 Stefan Dirsch 2018-09-03 12:52:29 UTC
I could reproduce after installing noto-sans-cjk-fonts. Works again after uninstalling these fonts. You may need to run

  /usr/sbin/fonts-config  -f -v

after (un)installing the fonts. AFAIK xfig doesn't use fontconfig at all, i.e. serverside font rendering only including fontsets. I'm not aware of any 
changes there.
Comment 6 Stefan Dirsch 2018-09-03 13:11:06 UTC
Seems to be related to xfig.3.2.3d-international-std-fonts.dif ...
Comment 7 Dr. Werner Fink 2018-09-03 13:49:01 UTC
(In reply to Stefan Dirsch from comment #6)
> Seems to be related to xfig.3.2.3d-international-std-fonts.dif ...

Without this patch there is no UTF-8 ... the question rises why it does crash on two different installations/accounts and not with my environment
Comment 8 Stefan Dirsch 2018-09-03 14:31:46 UTC
It was not my intention to remove this patch. ;-)
Comment 9 Stefan Dirsch 2018-09-03 14:39:54 UTC
Oh. Werner, you may need

  xset fp rehash

before you can reproduce that issue ...
Comment 10 Dr. Werner Fink 2018-09-03 14:49:01 UTC
(In reply to Stefan Dirsch from comment #9)
> Oh. Werner, you may need
> 
>   xset fp rehash
> 
> before you can reproduce that issue ...

I've done both

  /usr/sbin/fonts-config  -f -v

(even if the posttrans script does it I guess) and

  xset fp rehash

no crash but a warning now:

 > xfig
 Warning: Missing charsets in String to FontSet conversion
 Warning: Cannot convert string "-URW-Nimbus Roman No9 L-medium-r-normal-- 34-*-*-*-*-*-*-*,-kochi-mincho-medium-r-normal--34-*-*-*-*-*-jisx0208.19830,-baekmukttf-batang-medium-r-normal--34-*-*-*-*-*-ksc5601.1987-0,-*-times-medium-r-normal--34-*-*-*-*-*-*-*,-*-*-medium-r-normal--34-*-*-*-*-*-*-*,*--34-*-*-times-medium-r-normal--16-*-*-*-*-*-*-*,-*-*-medium-r-normal--16-*-*-*-*-*-*-*,*--16-*" to type FontSet
 Warning: Missing charsets in String to FontSet conversion
 Warning: Unable to load any usable fontset
 Warning: Missing charsets in String to FontSet conversion
 Warning: Unable to load any usable fontset

seems to be that one or more font(s) now does/do not fit the mask correctly
Comment 11 Dr. Werner Fink 2018-09-03 14:55:48 UTC
Interesting some of the messages do not occur on Tumbleweed ... the warning of xfig as well as the output or /usr/sbin/fonts-config seen on Leap 15

On Leap 15.0 the fonts-config command shows

 Couldn't determine full name for taipei24.bdf
 Couldn't determine slant for taipei24.bdf
 Couldn't determine weight for taipei24.bdf
 Couldn't get family name for taipei24.bdf
 Couldn't determine full name for thai24.bdf
 Couldn't determine slant for thai24.bdf
 Couldn't determine weight for thai24.bdf
 Couldn't get family name for thai24.bdf

and this does not happen on Tumbleweed
Comment 12 Dr. Werner Fink 2018-09-03 15:01:05 UTC
The only difference between fonts-config of Leap 15 and Tumbleweed in the changelog is

  * Mon Mar 12 2018 stefan.bruens@rwth-aachen.de
  - Do not create fonts.{dir,scale} in encodings directory
Comment 13 Dr. Werner Fink 2018-09-03 15:05:48 UTC
Those thai*.bfd fonts belong to package intlfonts-bdf-fonts, removed them. Now the messages of fonts-config is (beside the jave messages) clear.

The message from xfig still remains ...
Comment 14 Stefan Dirsch 2018-09-03 15:10:59 UTC
Werner, if I get the fontset warning xfig crashes once I try to open a file ...
Comment 15 Dr. Werner Fink 2018-09-03 15:11:27 UTC
Ah ... File->open then it does crash on Leap 15 but not on Tumbleweed ... I've copied the binary from Tumbleweed to ~/tmp/xfig and this binary does also crash on Leap 15 ... guess that one of the libaries are different
Comment 16 Giacomo Comes 2018-09-04 12:33:34 UTC
I'm cleaning the needinfo request without providing the info requested in comment 3 and 4 because you were able to reproduce the bug and also because I don't have any special setup/locale. I use the default English.

I'll add that I did apply the change mentioned in comment 12 to fonts-config in Leap 15.0 before submitting the bug, but that did not solve the issue.
Comment 17 Dr. Werner Fink 2018-09-04 13:37:55 UTC
(In reply to Giacomo Comes from comment #16)
> I'm cleaning the needinfo request without providing the info requested in
> comment 3 and 4 because you were able to reproduce the bug and also because
> I don't have any special setup/locale. I use the default English.
> 
> I'll add that I did apply the change mentioned in comment 12 to fonts-config
> in Leap 15.0 before submitting the bug, but that did not solve the issue.

Nevertheless I've no clue what cause the crash on Leap 15 in comparision to Tumbleweed.

Please give me two list both done with the prgram xlsfonts

   on Leap with   xlsfonts '*noto*' > fontlist.leap

   on Tumbleweed  xlsfonts '*noto*' > fontlist.tbw

and attach both files. Here I see that the '*jisx0*' as well as the '*ksc5601*' patterns are part of on Leap 15 ... but not on Tumbleweed


Maybe a change in mkfontscale and/or mkfontdir and/or fonts-config ... nevertheless after doing

  sed -ri '/noto.*(jisx0|ksc560)/d' /usr/share/fonts.scale
  sed -ri '/noto.*(jisx0|ksc560)/d' /usr/share/fonts/truetype/fonts.dir
  sed -ri '/noto.*ascii-0/d' /usr/share/fonts/truetype/fonts.scale
  sed -ri '/noto.*ascii-0/d' /usr/share/fonts/truetype/fonts.dir
  sed -ri '/noto.*(cns1164|gb18030|gb2312)/d' /usr/share/fonts/truetype/fonts.dir 
  sed -ri '/noto.*(cns1164|gb18030|gb2312)/d' /usr/share/fonts/truetype/fonts.scale

as root and under X

  xset fp rehash

the xfig command starts without error message and can open the open fule menu
Comment 18 Dr. Werner Fink 2018-09-04 14:00:21 UTC
Hmmm ... removing /usr/share/fonts/encodings/encodings.dir from Leap and executing "fonts-config  -f -v" as root and "xset fp rehash" as user seems also to solve the problem.

AFAIK the encodings.dir  will be written with "mkfontscale" or "mkfontdir" with specific options ... but on Leap it is part of package xorg-x11-fonts-core ... nad it had been dropped with

* Mon Mar 12 2018 stefan.bruens@rwth-aachen.de
- Cleanup packaging, see boo#1085143 for details:
  * Remove special handling for openSUSE 12.2 and earlier.
  * Mark fonts.{dir,scale} and encodings.dir as %ghost files instead
    of %config. These files are created by the %posttrans scriptlets
    so no need to ship these, also avoids creation of .rpmsave files.
    Also track these files consistently for all subdirs.
  * add .fonts-config-timestamp as %ghost, ignore if it is missing.
  * remove encodings.dir from encodings directories.
Comment 19 Dr. Werner Fink 2018-09-04 14:05:41 UTC
Even if this avoid crashing xfig ... I'd like to know why /usr/share/fonts/encodings/encodings.dir had been removed
Comment 20 Dr. Werner Fink 2018-09-04 14:18:38 UTC
Also doing as root

  cd /usr/share/fonts/encodings
  mkfontscale -n -e /usr/share/fonts/encodings

to recreate /usr/share/fonts/encodings/encodings.dir and then execute as root

  fonts-config  -f -v

and as user

  xset fp rehash

also allows to use xfig without error message and with open the file menu.

Now the

  xlsfonts '*noto*'

shows only the real known encodings for the noto fonts as found below /usr/share/fonts/encodings in encodings.dir

IMHO the original encodings.dir in Leap does not fit the content of thew directory  /usr/share/fonts/encodings with its encoding declarations
Comment 21 Stefan Dirsch 2018-09-04 15:55:05 UTC
(In reply to Dr. Werner Fink from comment #20)
> IMHO the original encodings.dir in Leap does not fit the content of the
> directory  /usr/share/fonts/encodings with its encoding declarations

Exactly. It does only fit for the fonts included by the xorg-x11-fonts-core package. Therefore Stefan Brüns removed it, so fonts-config needs to recreate it, so it matches the existing fonts again.

So actually this bug has been fixed in TW by this change. Looks like not so many applications still use X11 core font rendering. ;-)
Comment 22 Stefan Brüns 2018-09-04 18:44:12 UTC
(In reply to Stefan Dirsch from comment #21)
> (In reply to Dr. Werner Fink from comment #20)
> > IMHO the original encodings.dir in Leap does not fit the content of the
> > directory  /usr/share/fonts/encodings with its encoding declarations
> 
> Exactly. It does only fit for the fonts included by the xorg-x11-fonts-core
> package. Therefore Stefan Brüns removed it, so fonts-config needs to
> recreate it, so it matches the existing fonts again.
> 
> So actually this bug has been fixed in TW by this change. Looks like not so
> many applications still use X11 core font rendering. ;-)

Exactly.

/usr/share/fonts/encodings/encodings.dir is as pointless as /usr/share/fonts/encodings/fonts.{scale,dir}, as it provides information about the encodings for the *fonts* below /usr/share/fonts/encodings/, which is zilch, nada, nothing.

For the actual font directories, e.g. /usr/share/fonts/75dpi/, /usr/share/fonts/truetype/, ... all three files (fonts.scale, fonts.dir, encodings.dir) have to be created after installing or removing any font (unless you can guarantee only a single package ever installs a font into a directory, then you can prebuild and ship these files).

BTW, xset fp rehash is also pointless in the combination with the encodings/encodings.dir, unless you manually added the encodings dir to the *font* path (but why would you?). It may have the wanted effect if fonts.{dir,scale} in a font directory has been updated previously.
Comment 23 Dr. Werner Fink 2018-09-05 08:42:41 UTC
(In reply to Stefan Brüns from comment #22)
> For the actual font directories, e.g. /usr/share/fonts/75dpi/,
> /usr/share/fonts/truetype/, ... all three files (fonts.scale, fonts.dir,
> encodings.dir) have to be created after installing or removing any font
> (unless you can guarantee only a single package ever installs a font into a
> directory, then you can prebuild and ship these files).

In other words fonts-config is broken as it does not recreate the encoding.dir on both Tumbleweed and Leap 15

One of the very first command should be

   mkfontscale -n -e /usr/share/fonts/encodings /usr/share/fonts/encodings

also the special encodings below /usr/share/fonts/encodings/large/ might be
an option for those who need things like JIS (bah) or BIG5

After this every call of mkfontscale and mkfontdir has to use the option

   -e /usr/share/fonts/encodings


(In reply to Stefan Dirsch from comment #21)
> 
> So actually this bug has been fixed in TW by this change. Looks like not so
> many applications still use X11 core font rendering. ;-)

I'll not rewrite Xfig, sorry ;)
Comment 24 Stefan Dirsch 2018-09-05 10:01:34 UTC
Well, fonts-config doesn't rewrite fonts.scale/fonts.dir by default since it takes ages to regenerate them for each font package, which is being installed. It is done, if you specify "-f" though.

I'm sure we're going to create blocker bugs with Prio 1, if we change this default. Maybe one can change the default once a program like xfig, which uses X11 core fonts, is installed. So only these customers are affected by this change. Sorry, no better idea ..

Unfortunately SUSEconfig{,.fonts} is dead ...
Comment 25 Stefan Dirsch 2018-09-05 10:35:35 UTC
JFYI, encodings.dir files are created in the appropriate font directories by fonts-config script, which itself is running

  mkfontdir ... -e /usr/share/fonts/encodings/ -e /usr/share/fonts/encodings/large

Indeed it makes no sense to have fonts.dir/fonts.scale/encodings.dir files in  /usr/share/fonts/encodings{,/large}.
Comment 26 Stefan Brüns 2018-09-05 13:43:51 UTC
(In reply to Stefan Dirsch from comment #24)
> Well, fonts-config doesn't rewrite fonts.scale/fonts.dir by default since it
> takes ages to regenerate them for each font package, which is being
> installed. It is done, if you specify "-f" though.
> 
> I'm sure we're going to create blocker bugs with Prio 1, if we change this
> default. Maybe one can change the default once a program like xfig, which
> uses X11 core fonts, is installed. So only these customers are affected by
> this change. Sorry, no better idea ..
> 
> Unfortunately SUSEconfig{,.fonts} is dead ...

In general, the lazy creation of the fonts.scale etc should already be handled by the posttrans trigger in the various font packages.

- if mkfontdir/mkfontscale is installed, the fonts-config script creates the files
- if not, only fontconfig caches are renewed.

*If* a program/package requires core fonts, it should depend on mkfontscale and xorg-x11-fonts-core. The latter is required for the encodings, the former for processing it. The dependency on the encodings could also be transitive via mkfontscale. Currently it is possible to deinstall mkfontdir/mkfontscale, even when e.g. xfig is installed.

This way only installations actually using core fonts pay for it.

Unfortunately, the default installations contain xterm, which defaults to core fonts, although compiled with truetype support via fontconfig/freetype.
Comment 27 Dr. Werner Fink 2018-09-06 09:03:56 UTC
Just tested out, if I do

   LANG=POSIX
   unset ${!LC_*}

the xfig program works as expected ... in other words if more than the usual european encodings are found in the font list the resulting fontset for UTF-8 aka iso10646 are not found by the Xorg libraries. This could be caused by the fact that

   find /usr/share/fonts/ -name encodings.dir | xargs grep 10646

does not find any encoding but the fonts are there

   xlsfonts -fn  "*-iso10646-*"| wc -l
   1622

... there are some unicode maps for india but this is not utf-8 I guess

Remark: sometimes the encoding POSIX is simply called C
Comment 28 Dr. Werner Fink 2018-09-06 09:26:27 UTC
Now I've used the pattern

  "-urw-nimbus roman no9 l-medium-r-normal--34-*-*-*-*-*-*-*,"
  "-urw-nimbus roman no9 l-medium-r-normal--34-*-*-*-*-*-iso10646-1,"
  "-*-*-medium-r-normal--34-*-*-*-*-*-jisx0208.1983-0,"
  "-*-*-medium-r-normal--34-*-*-*-*-*-ksc5601.1987-0,"
  "-*-times-medium-r-normal--34-*-*-*-*-*-*-*,"
  "-*-*-medium-r-normal--34-*-*-*-*-*-*-*,"
  "*--34-*,"
  "-*-times-medium-r-normal--16-*-*-*-*-*-*-*,"
  "-*-*-medium-r-normal--16-*-*-*-*-*-*-*,"
  "*--16-*"

... which also does not catch any font ... but at least the

  "-urw-nimbus roman no9 l-medium-r-normal--34-*-*-*-*-*-iso10646-1,"

should be found by the fontset algorithm of the Xorg font libraries.

It seems that XtSetLanguageProc(3) does not know that UTF-8 or UTF8 maps to
ISO10646-1

 ifdef I18N
        setlocale(LC_ALL, "");
        setlocale(LC_NUMERIC, "C");
        XtSetLanguageProc(tool_app, NULL, NULL);
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 #endif  /* I18N */
        /* save important info */
        tool_d = XtDisplay(tool);
        tool_s = XtScreen(tool);
        tool_sn = DefaultScreen(tool_d);

        XtGetApplicationResources (tool, &Options, resources,
                                   XtNumber (resources), args, 0);
Comment 29 Stefan Dirsch 2018-09-06 09:48:43 UTC
Werner, there should be one encodings.dir in *every* font directory below /usr/share/fonts after running fonts-config. Otherwise there is something wrong on your system. mkfontscale, mkfontdir and xorg-x11-fonts-core are installed?
Comment 30 Dr. Werner Fink 2018-09-06 10:00:13 UTC
(In reply to Stefan Dirsch from comment #29)
> Werner, there should be one encodings.dir in *every* font directory below
> /usr/share/fonts after running fonts-config. Otherwise there is something
> wrong on your system. mkfontscale, mkfontdir and xorg-x11-fonts-core are
> installed?

AFAICS yes:

 rpmqpack  | grep -E 'mkfontdir|mkfontscale|xorg-x11-fonts-core'
 mkfontdir
 mkfontscale
 xorg-x11-fonts-core

had run as root

 mkfontscale -n -e /usr/share/fonts/encodings -e /usr/share/fonts/encodings/large /usr/share/fonts/encodings
 fonts-config  -f

and *after* this had finished as user

 xset fp rehash
 ~/tmp/xfig

where the ~/tmp/xfig is my hacked version with this pattern
Comment 31 Stefan Dirsch 2018-09-06 10:15:51 UTC
Werner, not sure why you want to create an encodings.dir in /usr/share/fonts/encodings. There are no fonts in this directory, only encodings. Instead you want to have an encodings.dir in every directory, where you have fonts installed. This is what fonts-config does via mkfontdir command.

    if ($mkfontdir_bin) {
      $command = "$mkfontdir_bin ";
      if (-d "/usr/share/fonts/encodings") {
        $command .= " -e /usr/share/fonts/encodings";
      }
      if (-d "/usr/share/fonts/encodings/large") {
        $command .= " -e /usr/share/fonts/encodings/large";
      }
      $command .= " $dir";
      my_system ($command);
    }
Comment 32 Dr. Werner Fink 2018-09-06 10:50:30 UTC
(In reply to Stefan Dirsch from comment #31)
> Werner, not sure why you want to create an encodings.dir in
> /usr/share/fonts/encodings. There are no fonts in this directory, only
> encodings. Instead you want to have an encodings.dir in every directory,
> where you have fonts installed. This is what fonts-config does via mkfontdir
> command.
> 
>     if ($mkfontdir_bin) {
>       $command = "$mkfontdir_bin ";
>       if (-d "/usr/share/fonts/encodings") {
>         $command .= " -e /usr/share/fonts/encodings";
>       }
>       if (-d "/usr/share/fonts/encodings/large") {
>         $command .= " -e /usr/share/fonts/encodings/large";
>       }
>       $command .= " $dir";
>       my_system ($command);
>     }

Hmm ... as root

  rm /usr/share/fonts/encodings/encodings.dir

as user

  xset fp rehash
  ~/tmp/xfig
  Warning: Missing charsets in String to FontSet conversion
  Warning: Cannot convert string "-urw-nimbus roman no9 l-medium-r-normal--34-*-*-*-*-*-*-*,-*-*-medium-r-normal--34-*-*-*-*-*-jisx0208.1983-0,-*-*-medium-r-normal--34-*-*-*-*-*-ksc5601.1987-0,-*-times-medium-r-normal--34-*-*-*-*-*-*-*,-*-*-medium-r-normal--34-*-*-*-*-*-*-*,*--34-*,-*-times-medium-r-normal--16-*-*-*-*-*-*-*,-*-*-medium-r-normal--16-*-*-*-*-*-*-*,*--16-*" to type FontSet
  Warning: Missing charsets in String to FontSet conversion
  Warning: Unable to load any usable fontset
  Warning: Missing charsets in String to FontSet conversion
  Warning: Unable to load any usable fontset
  Error: Aborting: no fontset found

only if I run

  fonts-config -f

before the user space rehash it works but then no JIS nor KSC encoded fonts are found ...

  xlsfonts -fn "-*-*-medium-r-normal--34-*-*-*-*-*-jisx0208.1983-0" | wc -l
  xlsfonts: pattern "-*-*-medium-r-normal--34-*-*-*-*-*-jisx0208.1983-0" unmatched
  0xlsfonts -fn "*-medium-r-normal--34-*-*-*-*-*-ksc5601.1987-0" | wc -l
  xlsfonts: pattern "*-medium-r-normal--34-*-*-*-*-*-ksc5601.1987-0" unmatched
  0

IMHO this is for what had the /usr/share/fonts/encodings/encodings.dir been used in past, that is to get other encodings
Comment 33 Dr. Werner Fink 2018-09-06 11:44:05 UTC
Now in xfig the code will fall back to LC_CTYPE "C" if locale comes with UTF-8 ... with this *workaround* the Xt library will find a useful fontset even if a large encoding.dir below /usr/share/fonts/ exists which enable JIS, KSR, and other large encodings.

Also I've open an upstream issue https://sourceforge.net/p/mcj/tickets/33/ and I hope that this might help to get a better UTF-8 and/or Xft support in XFig.
Comment 34 Swamp Workflow Management 2018-09-06 12:30:06 UTC
This is an autogenerated message for OBS integration:
This bug (1106850) was mentioned in
https://build.opensuse.org/request/show/633729 15.0 / xfig
Comment 35 Dr. Werner Fink 2018-09-06 14:56:24 UTC
Problem: with locale LC_CTYPE set to C the fontset scanning works, but now Text objects as well as file names are broken as now in latin.

Without the workaround UTF-8 works

Revoke SR#633729

This problem is not solvable within xfig code.  For fontsets with large encodings like JIS and KSC an UTF-8 locale does not work.  Hence the /usr/share/fonts/encodings/encodings.dir should to removed or the Xorg libraries fixed to find the fonts even with an UTF-8 locale
Comment 36 Dr. Werner Fink 2018-09-06 15:02:41 UTC
This piece of code

    for (n=0; n < XtNumber(application_resources); n++) {
        if (strcmp(application_resources[n].resource_name, "fixedFontSet") == 0) {
            int c, nmissing;
            char **missing;
            char *def_string;
            XFontSet fset = XCreateFontSet(XtDisplay(tool),
                 application_resources[n].default_addr, &missing, &nmissing, &def_string);
            for (c = 0; c < nmissing; c++)
                fprintf(stderr, "%s\n", missing[c]);
            if (def_string)
                fprintf(stderr, "%s\n", def_string);
            XFreeFontSet(XtDisplay(tool), fset);
     }

returns

 missed ISO8859-1
 missed ISO8859-1
 missed ISO8859-2
 missed ISO8859-3
 missed ISO8859-4
 missed ISO8859-5
 missed KOI8-R
 missed ISO8859-7
 missed ISO8859-9
 missed ISO8859-13
 missed ISO8859-14
 missed ISO8859-15
 missed JISX0208.1983-0
 missed KSC5601.1987-0
 missed GB2312.1980-0
 missed JISX0201.1976-0
 missed ISO10646-1

which is nearly all
Comment 37 Stefan Brüns 2018-09-06 15:43:35 UTC
(In reply to Dr. Werner Fink from comment #32)
>   xset fp rehash
>   ~/tmp/xfig
>   Warning: Missing charsets in String to FontSet conversion

^ Caused by the KOI-R encoding in
/usr/share/X11/locale/en_US.UTF-8/XLC_LOCALE

Most *_*.UTF-8 encoding are mapped to en_US.UTF-8, see
/usr/share/X11/locale/locale.dir

If you use e.g. "LC_ALL=pt_PT.UTF-8  xfig", the message vanishes. Or you can remove the "KOI-R" stanza from en_US.UTF-8/XLC_LOCALE

> 
> before the user space rehash it works but then no JIS nor KSC encoded fonts
> are found ...
> 
>   xlsfonts -fn "-*-*-medium-r-normal--34-*-*-*-*-*-jisx0208.1983-0" | wc -l
>   xlsfonts: pattern "-*-*-medium-r-normal--34-*-*-*-*-*-jisx0208.1983-0"
> unmatched
>   0xlsfonts -fn "*-medium-r-normal--34-*-*-*-*-*-ksc5601.1987-0" | wc -l
>   xlsfonts: pattern "*-medium-r-normal--34-*-*-*-*-*-ksc5601.1987-0"
> unmatched
>   0

"...-34-*..." - pixelSize 34. The above encodings are only provided in size 16 and 24, at least in the hangul fonts from xorg-x11-fonts-core. Try xfontsel.
Comment 38 Stefan Brüns 2018-09-06 15:49:44 UTC
(In reply to Dr. Werner Fink from comment #27)
> Just tested out, if I do
> 
>    LANG=POSIX
>    unset ${!LC_*}
> 
> the xfig program works as expected ... in other words if more than the usual
> european encodings are found in the font list the resulting fontset for
> UTF-8 aka iso10646 are not found by the Xorg libraries. This could be caused
> by the fact that
> 
>    find /usr/share/fonts/ -name encodings.dir | xargs grep 10646
> 
> does not find any encoding but the fonts are there

https://www.x.org/archive/X11R7.5/doc/fonts/fonts.html

"A number of encodings are hardwired into fontenc, and are therefore always available; the hardcoded encodings cannot easily be redefined. These include:
- iso10646-1: Unicode;
- ...
Additional encodings can be added by defining encoding files."
Comment 39 Stefan Dirsch 2018-09-07 10:35:29 UTC
Ok, guys. Now I'm completely confused. :-(

I'm happy to make the changes Stefan Brüns did for TW in xorg-x11-fonts

-------------------------------------------------------------------
Mon Mar 12 22:08:13 UTC 2018 - stefan.bruens@rwth-aachen.de

- Cleanup packaging, see boo#1085143 for details:
  * Remove special handling for openSUSE 12.2 and earlier.
  * Mark fonts.{dir,scale} and encodings.dir as %ghost files instead
    of %config. These files are created by the %posttrans scriptlets
    so no need to ship these, also avoids creation of .rpmsave files.
    Also track these files consistently for all subdirs.
  * add .fonts-config-timestamp as %ghost, ignore if it is missing.
  * remove encodings.dir from encodings directories.

But what else is needed here? Let mkfontscale and mkfontdir require xorg-x11-fonts-core?
Comment 40 Stefan Dirsch 2018-09-07 12:22:31 UTC
Ok. If we no longer want to see encodings.dir, fonts.scale and fonts.dir files in /usr/share/fonts/encodings, we also need this pach against fonts-config.

--- fonts-config.orig   2018-09-07 14:05:27.952127835 +0200
+++ fonts-config        2018-09-07 14:08:07.899184324 +0200
@@ -699,6 +699,7 @@
 # return existing system font dirs; assume all are under /usr/share/fonts
 sub x11_font_dirs {
   my @blacklist_dirs = ("/usr/share/fonts", 
+                        "/usr/share/fonts/encodings",
                         "/usr/share/fonts/encodings/large");
   my @dirs = split(/\n/,`find -L /usr/share/fonts -type d`);
Comment 41 Stefan Brüns 2018-09-07 14:12:36 UTC
(In reply to Stefan Dirsch from comment #40)
> Ok. If we no longer want to see encodings.dir, fonts.scale and fonts.dir
> files in /usr/share/fonts/encodings, we also need this pach against
> fonts-config.
> 
> --- fonts-config.orig   2018-09-07 14:05:27.952127835 +0200
> +++ fonts-config        2018-09-07 14:08:07.899184324 +0200
> @@ -699,6 +699,7 @@
>  # return existing system font dirs; assume all are under /usr/share/fonts
>  sub x11_font_dirs {
>    my @blacklist_dirs = ("/usr/share/fonts", 
> +                        "/usr/share/fonts/encodings",
>                          "/usr/share/fonts/encodings/large");
>    my @dirs = split(/\n/,`find -L /usr/share/fonts -type d`);

Looks good to me.

Re #39:

I just checked what happens when running mkfontdir/mkfontscale *without* xorg-x11-fonts-core, i.e. without the *extra* encodings:

It creates the same entries for the hardwired encodings (iso8859-*, iso10646-1, koi8-r), which should be sufficient for anyone running a *.UTF-8 locale, i.e. almost everyone.

-> mkfontdir/mkfontscale should have a Suggests/Recommends xorg-x11-fonts-core, but a Requires is to much

Any package depending on X core fonts (e.g. xfig) should Require at least mkfontdir, and also the specific font packages if it depends on a specific font. It should probably also require at least one font package (which could also be a scalable font).
Comment 42 Stefan Dirsch 2018-09-10 10:17:05 UTC
(In reply to Stefan Brüns from comment #41)
> (In reply to Stefan Dirsch from comment #40)
> > Ok. If we no longer want to see encodings.dir, fonts.scale and fonts.dir
> > files in /usr/share/fonts/encodings, we also need this pach against
> > fonts-config.
> > 
> > --- fonts-config.orig   2018-09-07 14:05:27.952127835 +0200
> > +++ fonts-config        2018-09-07 14:08:07.899184324 +0200
> > @@ -699,6 +699,7 @@
> >  # return existing system font dirs; assume all are under /usr/share/fonts
> >  sub x11_font_dirs {
> >    my @blacklist_dirs = ("/usr/share/fonts", 
> > +                        "/usr/share/fonts/encodings",
> >                          "/usr/share/fonts/encodings/large");
> >    my @dirs = split(/\n/,`find -L /usr/share/fonts -type d`);
> 
> Looks good to me.

That's already fixed in git/TW.

commit e9980b5268043bb8f480dec3adc0ea9c198d80b6
Author: marguerite <i@marguerite.su>
Date:   Mon Apr 30 11:35:29 2018 +0800

    Do not create fonts.{dir,scale} in encodings directory

diff --git a/fonts-config b/fonts-config
index 3098782..01ab235 100644
--- a/fonts-config
+++ b/fonts-config
@@ -698,7 +698,8 @@ sub mkfont_scale_dir {
 
 # return existing system font dirs; assume all are under /usr/share/fonts
 sub x11_font_dirs {
-  my @blacklist_dirs = ("/usr/share/fonts", 
+  my @blacklist_dirs = ("/usr/share/fonts",
+                        "/usr/share/fonts/encodings",
                         "/usr/share/fonts/encodings/large");
   my @dirs = split(/\n/,`find -L /usr/share/fonts -type d`);
Comment 43 Stefan Dirsch 2018-09-10 10:28:25 UTC
(In reply to Stefan Brüns from comment #41)
> -> mkfontdir/mkfontscale should have a Suggests/Recommends
> xorg-x11-fonts-core, but a Requires is to much

Now fixed for factory/TW.
Comment 44 Dr. Werner Fink 2018-09-10 10:36:28 UTC
The bug is about Leap 15 ;)
Comment 45 Stefan Dirsch 2018-09-10 10:37:34 UTC
(In reply to Stefan Brüns from comment #41)
> Any package depending on X core fonts (e.g. xfig) should Require at least
> mkfontdir, and also the specific font packages if it depends on a specific
> font. It should probably also require at least one font package (which could
> also be a scalable font).

Added mkfontdir to requires of xfig for its devel project now. xfig already has requires to appropriate font packages. So for TW this issue
should be resolved now hopefully.
Comment 46 Stefan Dirsch 2018-09-10 10:44:38 UTC
(In reply to Dr. Werner Fink from comment #44)
> The bug is about Leap 15 ;)

I know, but we cannot provide maintenance updates for everything. And there have been massive changes in fonts-config between Leap 15 and TW I just noticed ...
Comment 47 Dr. Werner Fink 2018-09-10 10:48:58 UTC
(In reply to Stefan Dirsch from comment #46)
> (In reply to Dr. Werner Fink from comment #44)
> > The bug is about Leap 15 ;)
> 
> I know, but we cannot provide maintenance updates for everything. And there
> have been massive changes in fonts-config between Leap 15 and TW I just
> noticed ...

This does not help for xfig on Leap 15 with installed noto-snoto-sans-cjk-fontsans-cjk-fonts

@ Giacomo ... can you live with the workaround like removing


   rm /usr/share/fonts/encodings/encodings.dir
   fonts-config
   
   xset fp rehash
Comment 48 Swamp Workflow Management 2018-09-10 11:00:06 UTC
This is an autogenerated message for OBS integration:
This bug (1106850) was mentioned in
https://build.opensuse.org/request/show/634708 Factory / mkfontdir
https://build.opensuse.org/request/show/634709 Factory / mkfontscale
Comment 49 Stefan Dirsch 2018-09-10 12:00:58 UTC
(In reply to Dr. Werner Fink from comment #47)
> This does not help for xfig on Leap 15 with installed
> noto-snoto-sans-cjk-fontsans-cjk-fonts
> [...]

I guess this should be noto-sans-cjk-fonts ;-)
Comment 50 Giacomo Comes 2018-09-10 15:48:31 UTC
(In reply to Dr. Werner Fink from comment #47)
> (In reply to Stefan Dirsch from comment #46)
> > (In reply to Dr. Werner Fink from comment #44)
> > > The bug is about Leap 15 ;)
> > 
> > I know, but we cannot provide maintenance updates for everything. And there
> > have been massive changes in fonts-config between Leap 15 and TW I just
> > noticed ...
> 
> This does not help for xfig on Leap 15 with installed
> noto-snoto-sans-cjk-fontsans-cjk-fonts
> 
> @ Giacomo ... can you live with the workaround like removing
> 
> 
>    rm /usr/share/fonts/encodings/encodings.dir
>    fonts-config
>    
>    xset fp rehash

The proper workaround sequence is:
    rm /usr/share/fonts/encodings/encodings.dir
    touch /usr/share/fonts/truetype (fonts-config check for timestamps and without this touch it does not do a proper job)
    fonts-config

    xset fp rehash

The problem with this workaround is that when a font rpm get installed/removed/updated, the issue come back.

    The proper fix for this problem is to also add the patch in comment 40 to fonts-config. In this way adding/removing fonts does not cause trouble.
Comment 51 Giacomo Comes 2018-09-10 15:52:56 UTC
(In reply to Stefan Dirsch from comment #46)
> (In reply to Dr. Werner Fink from comment #44)
> > The bug is about Leap 15 ;)
> 
> I know, but we cannot provide maintenance updates for everything. And there
> have been massive changes in fonts-config between Leap 15 and TW I just
> noticed ...

I'm lost here. The only difference between fonts-config in Leap 15 and TW is the patch of comment 40. Where are the massive changes?

Also is there any reason to not apply such patch in Leap 15?
Comment 52 Stefan Dirsch 2018-09-11 02:26:45 UTC
Ok. If this is the only change, which is needed for fonts-config in Leap 15 I'm fine with that.
Comment 53 Stefan Dirsch 2018-09-11 04:24:16 UTC
(In reply to Stefan Dirsch from comment #52)
> Ok. If this is the only change, which is needed for fonts-config in Leap 15
> I'm fine with that.

done. Submitted for sle15. Once accepted, there will also be an update for Leap 15. Which can take months ...
Comment 55 Giacomo Comes 2018-09-11 05:09:00 UTC
(In reply to Stefan Dirsch from comment #53)
> (In reply to Stefan Dirsch from comment #52)
> > Ok. If this is the only change, which is needed for fonts-config in Leap 15
> > I'm fine with that.
> 
> done. Submitted for sle15. Once accepted, there will also be an update for
> Leap 15. Which can take months ...

Yes, I know. See for example bug 1095664. Bug "fixed" three months ago and still no sign of a Leap update.

<irony>
Sometime I ask myself why bother to report bugs for Leap. I should just report the bug for TW and wait for the next Leap release. Apparently that's faster.
</irony>
Comment 56 Stefan Dirsch 2018-09-11 09:57:44 UTC
Giacomo, I'm feeling with you! The thing is, that Leap 15 inherits the sources of sle 15. Therefore I need to submit for sle 15, so I won't lose fixes for our enterprise product. But it takes a rather long time until things get checked in into sle15 and then QA starts testing this and releases updates for it. 

And AFAIU no Leap updates are available before. And this really can take months. :-( I even tried submitting the fix for leap 15 in parallel. It was declined, since then it could no longer inherit the sources of sle 15. Sigh. :-(
Comment 59 Swamp Workflow Management 2018-12-21 20:18:13 UTC
SUSE-RU-2018:4230-1: An update that has four recommended fixes can now be installed.

Category: recommended (moderate)
Bug References: 1069468,1101985,1106850,998300
CVE References: 
Sources used:
SUSE Linux Enterprise Server 12-SP4 (src):    fonts-config-20180430-6.8.1
SUSE Linux Enterprise Server 12-SP3 (src):    fonts-config-20180430-6.8.1
SUSE Linux Enterprise Desktop 12-SP4 (src):    fonts-config-20180430-6.8.1
SUSE Linux Enterprise Desktop 12-SP3 (src):    fonts-config-20180430-6.8.1
Comment 60 Swamp Workflow Management 2018-12-23 02:10:10 UTC
openSUSE-RU-2018:4265-1: An update that has four recommended fixes can now be installed.

Category: recommended (moderate)
Bug References: 1069468,1101985,1106850,998300
CVE References: 
Sources used:
openSUSE Leap 42.3 (src):    fonts-config-20180430-7.6.1
Comment 65 Swamp Workflow Management 2020-06-17 13:14:48 UTC
SUSE-RU-2020:1631-1: An update that has 6 recommended fixes can now be installed.

Category: recommended (important)
Bug References: 1049056,1092737,1101985,1106850,1111791,1172022
CVE References: 
Sources used:
SUSE Linux Enterprise Server for SAP 15 (src):    fonts-config-20200609+git0.42e2b1b-4.7.1
SUSE Linux Enterprise Server 15-LTSS (src):    fonts-config-20200609+git0.42e2b1b-4.7.1
SUSE Linux Enterprise Module for Basesystem 15-SP2 (src):    fonts-config-20200609+git0.42e2b1b-4.7.1
SUSE Linux Enterprise Module for Basesystem 15-SP1 (src):    fonts-config-20200609+git0.42e2b1b-4.7.1
SUSE Linux Enterprise High Performance Computing 15-LTSS (src):    fonts-config-20200609+git0.42e2b1b-4.7.1
SUSE Linux Enterprise High Performance Computing 15-ESPOS (src):    fonts-config-20200609+git0.42e2b1b-4.7.1

NOTE: This line indicates an update has been released for the listed product(s). At times this might be only a partial fix. If you have questions please reach out to maintenance coordination.
Comment 66 Swamp Workflow Management 2020-06-22 22:19:24 UTC
openSUSE-RU-2020:0843-1: An update that has 6 recommended fixes can now be installed.

Category: recommended (important)
Bug References: 1049056,1092737,1101985,1106850,1111791,1172022
CVE References: 
Sources used:
openSUSE Leap 15.1 (src):    fonts-config-20200609+git0.42e2b1b-lp151.4.3.1
Comment 68 Liu Shukui 2021-07-20 07:25:18 UTC
bug seems not fixed on sle12sp5

s12sp5-t5810:~ # rpm -q noto-sans-cjk-fonts
noto-sans-cjk-fonts-20170403-1.13.noarch

s12sp5-t5810:~ # rpm -q xfig 
xfig-3.2.8a-4.3.1.x86_64

s12sp5-t5810:~ # valgrind  xfig 
==1855== Memcheck, a memory error detector
==1855== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==1855== Using Valgrind-3.15.0 and LibVEX; rerun with -h for copyright info
==1855== Command: xfig
==1855== 
Warning: Missing charsets in String to FontSet conversion
Warning: Cannot convert string "7x13bold" to type FontStruct
Warning: Missing charsets in String to FontSet conversion
Warning: Unable to load any usable fontset
==1855== Conditional jump or move depends on uninitialised value(s)
==1855==    at 0x4E5F57C: ??? (in /usr/lib64/libXaw3d.so.8.0.0)
==1855==    by 0x50BBB73: _XtMakeGeometryRequest (in /usr/lib64/libXt.so.6.0.0)
==1855==    by 0x50CF3F2: XtSetValues (in /usr/lib64/libXt.so.6.0.0)
==1855==    by 0x471D94: ??? (in /usr/bin/xfig)
==1855==    by 0x471F85: ??? (in /usr/bin/xfig)
==1855==    by 0x473708: ??? (in /usr/bin/xfig)
==1855==    by 0x40932C: ??? (in /usr/bin/xfig)
==1855==    by 0x6013A34: (below main) (in /lib64/libc-2.22.so)
==1855== 
==1855== Conditional jump or move depends on uninitialised value(s)
==1855==    at 0x4E5F57C: ??? (in /usr/lib64/libXaw3d.so.8.0.0)
==1855==    by 0x50BBB73: _XtMakeGeometryRequest (in /usr/lib64/libXt.so.6.0.0)
==1855==    by 0x50CF3F2: XtSetValues (in /usr/lib64/libXt.so.6.0.0)
==1855==    by 0x473408: ??? (in /usr/bin/xfig)
==1855==    by 0x473812: ??? (in /usr/bin/xfig)
==1855==    by 0x40932C: ??? (in /usr/bin/xfig)
==1855==    by 0x6013A34: (below main) (in /lib64/libc-2.22.so)
==1855== 
==1855== Syscall param writev(vector[...]) points to uninitialised byte(s)
==1855==    at 0x60D8760: __writev_nocancel (in /lib64/libc-2.22.so)
==1855==    by 0x6BF261D: ??? (in /usr/lib64/libxcb.so.1.1.0)
==1855==    by 0x6BF29B0: ??? (in /usr/lib64/libxcb.so.1.1.0)
==1855==    by 0x6BF2A30: xcb_writev (in /usr/lib64/libxcb.so.1.1.0)
==1855==    by 0x5340CD5: _XSend (in /usr/lib64/libX11.so.6.3.0)
==1855==    by 0x5336613: XPutImage (in /usr/lib64/libX11.so.6.3.0)
==1855==    by 0x5320D0C: XCreatePixmapFromBitmapData (in /usr/lib64/libX11.so.6.3.0)
==1855==    by 0x4A58DC: ??? (in /usr/bin/xfig)
==1855==    by 0x409794: ??? (in /usr/bin/xfig)
==1855==    by 0x6013A34: (below main) (in /lib64/libc-2.22.so)
==1855==  Address 0x82d4715 is 5 bytes inside a block of size 256 alloc'd
==1855==    at 0x4C2A2AF: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==1855==    by 0x5343616: _XAllocScratch (in /usr/lib64/libX11.so.6.3.0)
==1855==    by 0x5335DEF: ??? (in /usr/lib64/libX11.so.6.3.0)
==1855==    by 0x5336613: XPutImage (in /usr/lib64/libX11.so.6.3.0)
==1855==    by 0x5320D0C: XCreatePixmapFromBitmapData (in /usr/lib64/libX11.so.6.3.0)
==1855==    by 0x4A58DC: ??? (in /usr/bin/xfig)
==1855==    by 0x409794: ??? (in /usr/bin/xfig)
==1855==    by 0x6013A34: (below main) (in /lib64/libc-2.22.so)
==1855== 
==1855== Invalid read of size 1
==1855==    at 0x4554A5: ??? (in /usr/bin/xfig)
==1855==    by 0x53433AD: _XIOError (in /usr/lib64/libX11.so.6.3.0)
==1855==    by 0x5340DAC: _XEventsQueued (in /usr/lib64/libX11.so.6.3.0)
==1855==    by 0x5332D8A: XEventsQueued (in /usr/lib64/libX11.so.6.3.0)
==1855==    by 0x50C39E6: _XtWaitForSomething (in /usr/lib64/libXt.so.6.0.0)
==1855==    by 0x50C4896: XtAppNextEvent (in /usr/lib64/libXt.so.6.0.0)
==1855==    by 0x409B6E: ??? (in /usr/bin/xfig)
==1855==    by 0x6013A34: (below main) (in /lib64/libc-2.22.so)
==1855==  Address 0x21 is not stack'd, malloc'd or (recently) free'd
==1855== 

xfig3.2.8a: SIGSEGV signal trapped
xfig: Figure is empty or not modified - exiting without saving.
==1855== 
==1855== Process terminating with default action of signal 6 (SIGABRT): dumping core
==1855==    at 0x6028247: raise (in /lib64/libc-2.22.so)
==1855==    by 0x6029619: abort (in /lib64/libc-2.22.so)
==1855==    by 0x472092: ??? (in /usr/bin/xfig)
==1855==    by 0x60282BF: ??? (in /lib64/libc-2.22.so)
==1855==    by 0x4554A4: ??? (in /usr/bin/xfig)
==1855==    by 0x53433AD: _XIOError (in /usr/lib64/libX11.so.6.3.0)
==1855==    by 0x5340DAC: _XEventsQueued (in /usr/lib64/libX11.so.6.3.0)
==1855==    by 0x5332D8A: XEventsQueued (in /usr/lib64/libX11.so.6.3.0)
==1855==    by 0x50C39E6: _XtWaitForSomething (in /usr/lib64/libXt.so.6.0.0)
==1855==    by 0x50C4896: XtAppNextEvent (in /usr/lib64/libXt.so.6.0.0)
==1855==    by 0x409B6E: ??? (in /usr/bin/xfig)
==1855==    by 0x6013A34: (below main) (in /lib64/libc-2.22.so)
==1855== 
==1855== HEAP SUMMARY:
==1855==     in use at exit: 977,952 bytes in 4,417 blocks
==1855==   total heap usage: 30,431 allocs, 26,014 frees, 6,401,530 bytes allocated
==1855== 
==1855== LEAK SUMMARY:
==1855==    definitely lost: 7,013 bytes in 27 blocks
==1855==    indirectly lost: 152 bytes in 10 blocks
==1855==      possibly lost: 0 bytes in 0 blocks
==1855==    still reachable: 970,787 bytes in 4,380 blocks
==1855==         suppressed: 0 bytes in 0 blocks
==1855== Rerun with --leak-check=full to see details of leaked memory
==1855== 
==1855== Use --track-origins=yes to see where uninitialised values come from
==1855== For lists of detected and suppressed errors, rerun with: -s
==1855== ERROR SUMMARY: 6 errors from 4 contexts (suppressed: 0 from 0)
Aborted (core dumped)
Comment 69 Liu Shukui 2021-07-23 11:52:48 UTC
(In reply to Liu Shukui from comment #68)
> bug seems not fixed on sle12sp5
> 
> s12sp5-t5810:~ # rpm -q noto-sans-cjk-fonts
> noto-sans-cjk-fonts-20170403-1.13.noarch
> 
> s12sp5-t5810:~ # rpm -q xfig 
> xfig-3.2.8a-4.3.1.x86_64
> 
> s12sp5-t5810:~ # valgrind  xfig 
> ==1855== Memcheck, a memory error detector
> ==1855== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
> ==1855== Using Valgrind-3.15.0 and LibVEX; rerun with -h for copyright info
> ==1855== Command: xfig
> ==1855== 
> Warning: Missing charsets in String to FontSet conversion
> Warning: Cannot convert string "7x13bold" to type FontStruct
> Warning: Missing charsets in String to FontSet conversion
> Warning: Unable to load any usable fontset
> ==1855== Conditional jump or move depends on uninitialised value(s)
> ==1855==    at 0x4E5F57C: ??? (in /usr/lib64/libXaw3d.so.8.0.0)
> ==1855==    by 0x50BBB73: _XtMakeGeometryRequest (in
> /usr/lib64/libXt.so.6.0.0)
> ==1855==    by 0x50CF3F2: XtSetValues (in /usr/lib64/libXt.so.6.0.0)
> ==1855==    by 0x471D94: ??? (in /usr/bin/xfig)
> ==1855==    by 0x471F85: ??? (in /usr/bin/xfig)
> ==1855==    by 0x473708: ??? (in /usr/bin/xfig)
> ==1855==    by 0x40932C: ??? (in /usr/bin/xfig)
> ==1855==    by 0x6013A34: (below main) (in /lib64/libc-2.22.so)
> ==1855== 
> ==1855== Conditional jump or move depends on uninitialised value(s)
> ==1855==    at 0x4E5F57C: ??? (in /usr/lib64/libXaw3d.so.8.0.0)
> ==1855==    by 0x50BBB73: _XtMakeGeometryRequest (in
> /usr/lib64/libXt.so.6.0.0)
> ==1855==    by 0x50CF3F2: XtSetValues (in /usr/lib64/libXt.so.6.0.0)
> ==1855==    by 0x473408: ??? (in /usr/bin/xfig)
> ==1855==    by 0x473812: ??? (in /usr/bin/xfig)
> ==1855==    by 0x40932C: ??? (in /usr/bin/xfig)
> ==1855==    by 0x6013A34: (below main) (in /lib64/libc-2.22.so)
> ==1855== 
> ==1855== Syscall param writev(vector[...]) points to uninitialised byte(s)
> ==1855==    at 0x60D8760: __writev_nocancel (in /lib64/libc-2.22.so)
> ==1855==    by 0x6BF261D: ??? (in /usr/lib64/libxcb.so.1.1.0)
> ==1855==    by 0x6BF29B0: ??? (in /usr/lib64/libxcb.so.1.1.0)
> ==1855==    by 0x6BF2A30: xcb_writev (in /usr/lib64/libxcb.so.1.1.0)
> ==1855==    by 0x5340CD5: _XSend (in /usr/lib64/libX11.so.6.3.0)
> ==1855==    by 0x5336613: XPutImage (in /usr/lib64/libX11.so.6.3.0)
> ==1855==    by 0x5320D0C: XCreatePixmapFromBitmapData (in
> /usr/lib64/libX11.so.6.3.0)
> ==1855==    by 0x4A58DC: ??? (in /usr/bin/xfig)
> ==1855==    by 0x409794: ??? (in /usr/bin/xfig)
> ==1855==    by 0x6013A34: (below main) (in /lib64/libc-2.22.so)
> ==1855==  Address 0x82d4715 is 5 bytes inside a block of size 256 alloc'd
> ==1855==    at 0x4C2A2AF: malloc (in
> /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
> ==1855==    by 0x5343616: _XAllocScratch (in /usr/lib64/libX11.so.6.3.0)
> ==1855==    by 0x5335DEF: ??? (in /usr/lib64/libX11.so.6.3.0)
> ==1855==    by 0x5336613: XPutImage (in /usr/lib64/libX11.so.6.3.0)
> ==1855==    by 0x5320D0C: XCreatePixmapFromBitmapData (in
> /usr/lib64/libX11.so.6.3.0)
> ==1855==    by 0x4A58DC: ??? (in /usr/bin/xfig)
> ==1855==    by 0x409794: ??? (in /usr/bin/xfig)
> ==1855==    by 0x6013A34: (below main) (in /lib64/libc-2.22.so)
> ==1855== 
> ==1855== Invalid read of size 1
> ==1855==    at 0x4554A5: ??? (in /usr/bin/xfig)
> ==1855==    by 0x53433AD: _XIOError (in /usr/lib64/libX11.so.6.3.0)
> ==1855==    by 0x5340DAC: _XEventsQueued (in /usr/lib64/libX11.so.6.3.0)
> ==1855==    by 0x5332D8A: XEventsQueued (in /usr/lib64/libX11.so.6.3.0)
> ==1855==    by 0x50C39E6: _XtWaitForSomething (in /usr/lib64/libXt.so.6.0.0)
> ==1855==    by 0x50C4896: XtAppNextEvent (in /usr/lib64/libXt.so.6.0.0)
> ==1855==    by 0x409B6E: ??? (in /usr/bin/xfig)
> ==1855==    by 0x6013A34: (below main) (in /lib64/libc-2.22.so)
> ==1855==  Address 0x21 is not stack'd, malloc'd or (recently) free'd
> ==1855== 
> 
> xfig3.2.8a: SIGSEGV signal trapped
> xfig: Figure is empty or not modified - exiting without saving.
> ==1855== 
> ==1855== Process terminating with default action of signal 6 (SIGABRT):
> dumping core
> ==1855==    at 0x6028247: raise (in /lib64/libc-2.22.so)
> ==1855==    by 0x6029619: abort (in /lib64/libc-2.22.so)
> ==1855==    by 0x472092: ??? (in /usr/bin/xfig)
> ==1855==    by 0x60282BF: ??? (in /lib64/libc-2.22.so)
> ==1855==    by 0x4554A4: ??? (in /usr/bin/xfig)
> ==1855==    by 0x53433AD: _XIOError (in /usr/lib64/libX11.so.6.3.0)
> ==1855==    by 0x5340DAC: _XEventsQueued (in /usr/lib64/libX11.so.6.3.0)
> ==1855==    by 0x5332D8A: XEventsQueued (in /usr/lib64/libX11.so.6.3.0)
> ==1855==    by 0x50C39E6: _XtWaitForSomething (in /usr/lib64/libXt.so.6.0.0)
> ==1855==    by 0x50C4896: XtAppNextEvent (in /usr/lib64/libXt.so.6.0.0)
> ==1855==    by 0x409B6E: ??? (in /usr/bin/xfig)
> ==1855==    by 0x6013A34: (below main) (in /lib64/libc-2.22.so)
> ==1855== 
> ==1855== HEAP SUMMARY:
> ==1855==     in use at exit: 977,952 bytes in 4,417 blocks
> ==1855==   total heap usage: 30,431 allocs, 26,014 frees, 6,401,530 bytes
> allocated
> ==1855== 
> ==1855== LEAK SUMMARY:
> ==1855==    definitely lost: 7,013 bytes in 27 blocks
> ==1855==    indirectly lost: 152 bytes in 10 blocks
> ==1855==      possibly lost: 0 bytes in 0 blocks
> ==1855==    still reachable: 970,787 bytes in 4,380 blocks
> ==1855==         suppressed: 0 bytes in 0 blocks
> ==1855== Rerun with --leak-check=full to see details of leaked memory
> ==1855== 
> ==1855== Use --track-origins=yes to see where uninitialised values come from
> ==1855== For lists of detected and suppressed errors, rerun with: -s
> ==1855== ERROR SUMMARY: 6 errors from 4 contexts (suppressed: 0 from 0)
> Aborted (core dumped)

is there any progress?
Comment 70 Stefan Dirsch 2021-07-23 12:15:43 UTC
If I understood correctly packages mkfontdir, mkfontscale and fonts-config needs to be updated here to fix the issue. Check in RPM changelog of the packages for this bug being mentioned. If the issue still occurs with the fixes applied it's likely a different issue, which needs to be handled separately.
Comment 71 Dr. Werner Fink 2021-07-23 12:30:33 UTC
What I see that SLE-12-SP5 does not have xfig-3.2.8a ... also SLE-15 does not have no xfig at all and no customer had ever complained.

Beside this I see the warnings:

 Warning: Missing charsets in String to FontSet conversion
 Warning: Cannot convert string "7x13bold" to type FontStruct
 Warning: Missing charsets in String to FontSet conversion
 Warning: Unable to load any usable fontset

therefore I guess that the mkfontdir hadn't been executed.

On tumbleweed it works flawless

 /suse/werner> rpmqpack | grep noto-sans-cjk-fonts
 noto-sans-cjk-fonts
 /suse/werner> xfig

works and indeed there is

 /suse/werner> rpm -qf /usr/bin/mkfontdir
 mkfontscale-1.2.1-1.6.x86_64
 /suse/werner> rpm -q xfig
 xfig-3.2.8a-2.1.x86_64
 /suse/werner> rpm -q noto-sans-cjk-fonts
 noto-sans-cjk-fonts-20201206-1.1.noarch

and the fonts are

 /suse/werner> find /usr/share/fonts -name 'fonts.dir' -o -name 'encodings.dir'  | wc -l
 257

all accesible for xfig
Comment 72 Stefan Dirsch 2021-07-23 13:31:00 UTC
Indeed. Originally this bug has been opened against Leap 15.0. Now it gets hijacked by a sle12-sp5 user. :-(
Comment 73 Swamp Workflow Management 2021-08-02 13:17:09 UTC
SUSE-RU-2021:2583-1: An update that has one recommended fix can now be installed.

Category: recommended (moderate)
Bug References: 1106850
CVE References: 
JIRA References: 
Sources used:
SUSE Linux Enterprise Software Development Kit 12-SP5 (src):    xfig-3.2.8a-4.3.1

NOTE: This line indicates an update has been released for the listed product(s). At times this might be only a partial fix. If you have questions please reach out to maintenance coordination.
Comment 74 OBSbugzilla Bot 2021-09-20 14:40:06 UTC
This is an autogenerated message for OBS integration:
This bug (1106850) was mentioned in
https://build.opensuse.org/request/show/920327 Backports:SLE-15 / xfig
Comment 75 Swamp Workflow Management 2021-10-02 13:16:08 UTC
openSUSE-RU-2021:1327-1: An update that has one recommended fix can now be installed.

Category: recommended (moderate)
Bug References: 1106850
CVE References: 
JIRA References: 
Sources used:
openSUSE Backports SLE-15 (src):    xfig-3.2.8a-bp150.3.3.1