Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 221921

Summary: Please use VARTEXFONTS="${T}/fonts" instead of addwrite /var/cache/fonts
Product: Gentoo Linux Reporter: Andrey Grozin <grozin>
Component: New packagesAssignee: TeX project <tex>
Status: RESOLVED OBSOLETE    
Severity: minor CC: common-lisp, martin, nerdboy, python
Priority: High    
Version: unspecified   
Hardware: All   
OS: Linux   
See Also: https://bugs.gentoo.org/show_bug.cgi?id=223077
Whiteboard:
Package list:
Runtime testing required: ---

Description Andrey Grozin gentoo-dev 2008-05-13 11:37:04 UTC
As discussed in http://groups.google.com/group/linux.gentoo.dev/browse_thread/thread/bf2e58fe200c0676/b72be3596cd2eb31
and also recently in gentoo-dev, it is better to export VARTEXFONTS="${T}/fonts" instead of addwriting /var/cache/fonts and its subdirectories. The latter method will stop working anyway when /var/cache/fonts will be not world-writable (bug #204433). Please update the following ebuilds:

app-doc/doxygen
app-office/kletterwizard
app-text/noweb
dev-lisp/cl-mcclim
dev-python/pyopenssl
dev-tex/feynmf
dev-tex/memoir
media-gfx/asymptote
media-libs/t1lib
media-libs/allegro
sci-chemistry/moldy
sci-mathematics/pari
sci-visualization/pyxplot


Reproducible: Always

Steps to Reproduce:
Comment 1 Ulrich Müller gentoo-dev 2008-05-13 12:29:31 UTC
I think that this is a step in the wrong direction, as not using the font cache is a needless waste of cpu time.

> As discussed in
> http://groups.google.com/group/linux.gentoo.dev/browse_thread/thread/bf2e58fe200c0676/b72be3596cd2eb31
> and also recently in gentoo-dev,

You have opened this bug only 14 hours after your initial posting to -dev, so you can't really say that the issue was discussed.
Comment 2 Tristan Heaven (RETIRED) gentoo-dev 2008-05-13 12:48:17 UTC
media-libs/allegro - tetex stuff was removed a while ago because the docs are available in other formats and because I didn't like having the addwrites in there. Just removed the old ebuild which still did this.
Comment 3 Andrey Grozin gentoo-dev 2008-05-13 12:56:48 UTC
(In reply to comment #1)
> > As discussed in
> > http://groups.google.com/group/linux.gentoo.dev/browse_thread/thread/bf2e58fe200c0676/b72be3596cd2eb31
> > and also recently in gentoo-dev,
> 
> You have opened this bug only 14 hours after your initial posting to -dev, so
> you can't really say that the issue was discussed.
This was discussed in November last year, and there was not a single voice against. Packages are already moving in this direction: app-text/jadetex, dev-tex/listings made this change recently. I think having a world-writable /var/cache/fonts is not a good idea, and possibly a security risk.

Comment 4 Marijn Schouten (RETIRED) gentoo-dev 2008-05-14 08:33:40 UTC
Alexis, please advise. There's gotta be some way to not bypass the sandbox without incurring a penalty of wasted cpu cycles.
Comment 5 Alexis Ballier gentoo-dev 2008-05-14 09:44:19 UTC
(In reply to comment #4)
> Alexis, please advise. There's gotta be some way to not bypass the sandbox
> without incurring a penalty of wasted cpu cycles.
> 

Quoting myself:
"""
Normally VARTEXFONTS is for writting fonts one needs to generate;
however, with the usual default configurations files I've seen,
overriding it will make the various apps needing 'em not see the
default font cache directory. I've committed a new tl-core ebuild with
default configuration files that will let it see the old font cache
directory even if VARTEXFONTS is changed, but will of course write to
VARTEXFONTS.
"""


(and btw I'm already on tex@g.o alias ;) )
Comment 6 Andrey Grozin gentoo-dev 2008-05-14 17:34:01 UTC
Done:
sci-chemistry/moldy
sci-mathematics/pari
sci-visualization/pyxplot
Comment 7 Marijn Schouten (RETIRED) gentoo-dev 2008-05-14 21:41:08 UTC
can we not simply write into "${D}"/var/cache/fonts if the font is not already cached?
Comment 8 Andrey Grozin gentoo-dev 2008-05-14 22:15:35 UTC
Then these fonts will be a part of the package files. If the package is uninstalled, they will be removed. If you produce a binary package, they will be in the binary tarball. Your package and my package will have different sets of files.
Comment 9 Marijn Schouten (RETIRED) gentoo-dev 2008-05-15 10:42:27 UTC
Surely you WANT fonts to be uninstalled when their package is uninstalled?
Comment 10 Andrey Grozin gentoo-dev 2008-05-15 11:19:07 UTC
(In reply to comment #9)
> Surely you WANT fonts to be uninstalled when their package is uninstalled?
Fonts which we are discussing have *absolutely* nothing to do with any package. We are discussing *.tfm and *.pk files generated on demand from metafont sources. Suppose I used LaTeX on articles A,B, and C; and you used it on D and E. Then I and you have different sets of fonts in out /var/cache/fonts directories. When I and you emerge the same package foo, different sets of fonts will be generated when latexing foo docs.
Any files in /var/cache/fonts (or even all of them) may be removed at any moment (and *are* removed automatically if unused for too long). This will not affect functionality of LaTeX, only its performance.
To stress the point: an accidental set of fonts generated by metafont when emerging a package foo is *not* a part of foo, and should not be lumped together with it in any form.
Comment 11 Ryan Hill (RETIRED) gentoo-dev 2008-05-24 00:42:30 UTC
media-libs/t1lib done.
Comment 12 Andrey Grozin gentoo-dev 2008-07-04 04:59:59 UTC
media-gfx/asymptote done
Comment 13 Ulrich Müller gentoo-dev 2008-09-01 08:33:02 UTC
dev-tex/feynmf done.
I've also changed its install location from texmf to texmf-site.
Comment 14 Martin Väth 2009-03-07 14:16:18 UTC
Since this issue came up in bug 261411:

It is IMHO unnatural to have /var/cache/fonts not world-writable (and sticky)
by default: In the "typical" usage of a TeX system all users should share the
generated fonts. The only case I can think of why you might not want to have
this is if you are afraid of an exploit of a TeX component by maliciously
crafted font data by another user.

Forcing VARTEXFONTS to a different value underruns this principle completely:
In the "typical" situation, the fonts have to be generated with each
installation of the package (with the change of comment #5 there is only
an exception if the fonts have been generated by another user for another
purpose).
Moreover, with the change of comment #5, such bad fonts can still be used to
exploit portage (and thus indirectly to obtain root privileges).

Perhaps it would be reasonable to introduce a global USE flag (or perhaps a
FEATURE in analogy to FEATURES=ccache) which lets the user decide...
Comment 15 Alexis Ballier gentoo-dev 2009-03-07 18:43:43 UTC
(In reply to comment #14)
> Since this issue came up in bug 261411:
> 
> It is IMHO unnatural to have /var/cache/fonts not world-writable (and sticky)
> by default: In the "typical" usage of a TeX system all users should share the
> generated fonts. The only case I can think of why you might not want to have
> this is if you are afraid of an exploit of a TeX component by maliciously
> crafted font data by another user.

... or fill the whole disk

> Perhaps it would be reasonable to introduce a global USE flag (or perhaps a
> FEATURE in analogy to FEATURES=ccache) which lets the user decide...

may I suggest you have a look at the last line of output of texmf-update?
Comment 16 Martin Väth 2009-03-07 20:49:21 UTC
(In reply to comment #15)
>
> may I suggest you have a look at the last line of output of texmf-update?

AFAIK this essentially only changes the permissions of /var/cache/fonts.
However, the ebuilds will then still not use /var/cache/fonts if they override
VARTEXFONTS (depending on the user's settings, the ebuilds might read from
/var/cache/fonts, but they will never write there).

Therefore, the user has no choice unless the choice is made available e.g.
by a USE-Flag from all ebuilds which currently set VARTEXFONTS for
installaion.

If the setting of VARTEXFONTS is done by inheriting some eclass (as was suggested now in bug 261411) this could easily be implemented by just testing
the corresponding USE-Flag in that eclass.
Comment 17 Alexis Ballier gentoo-dev 2009-03-08 16:06:14 UTC
(In reply to comment #16)
> (In reply to comment #15)
> >
> > may I suggest you have a look at the last line of output of texmf-update?
> 
> AFAIK this essentially only changes the permissions of /var/cache/fonts.

yes

> However, the ebuilds will then still not use /var/cache/fonts if they override
> VARTEXFONTS (depending on the user's settings, the ebuilds might read from
> /var/cache/fonts, but they will never write there).

yes; note that /var/cache/fonts may be changed by editing TeX config files.

> Therefore, the user has no choice unless the choice is made available e.g.
> by a USE-Flag from all ebuilds which currently set VARTEXFONTS for
> installaion.

an useflag is clearly an overkill

> If the setting of VARTEXFONTS is done by inheriting some eclass (as was
> suggested now in bug 261411) this could easily be implemented by just testing
> the corresponding USE-Flag in that eclass.

All this has already been discussed; if you wish fonts cache that are generated in $T/fonts to be merged back in the global font cache in a pkg_* phase then I have nothing against it but I still have to see some code.

Note that:
- the font cache isn't necessarily /var/cache/fonts, you have to get it from kpsewhich
- it is perfectly valid to make it readonly so you must not write there in that case, even if you're doing it with root privileges if you want to honour user settings
- pkg_* phases are ran as root so writing to an arbitrary directory (VARTEXFONTS) that can be overriden by environment variables as root might not be a so good idea.

In the end I think the current way of setting VARTEXFONTS causing useless font computations isn't perfect but is the only easy way of doing it sanely.
Comment 18 Martin Väth 2009-03-10 12:06:52 UTC
> if you wish fonts cache that are generated in $T/fonts to be merged back
> in the global font cache in a pkg_* phase

Despite of that this is probably not possible when building/merging binary
packages (I suppose $T is not packaged), I also would not vote for doing this
unless the user agrees (-> use-flag). After all, it might be a huge amount of
exotic fonts which might be just a waste of disk space.
You are right, for most packages it is probably just not worth the discussion.
I was mainly thinking about packages like lilypond where the TeX-font-generation
takes a considerable amount of time, but looking at the ebuild it appears that
this is unrelated.
Comment 19 Samuli Suominen (RETIRED) gentoo-dev 2009-10-13 16:43:00 UTC
Removing kde@ from CC. If there's issues with some package, please open a bug against it.