foo vs. foo-sys (was Re: Yes, I did read *all* your email was Re: [OS X TeX] Building new formats (MacTeX))

Bruno Voisin bvoisin at mac.com
Mon Sep 25 03:10:31 CEST 2006


[I'm cc'ing this part of an off-list conversation between Rowland and  
myself to the OS X TeX list, as I think the following is information  
that may be of interest to other members of the list as well.  
Actually, the more I look at the issue of foo vs. foo-sys, the more  
involved the issue looks to me, and the less I realize I had  
understood about it. There really is a problem in the way the various  
utilities such as fmtutil and updmap are documented. To those who  
know more than I do on these matter: please don't hesitate to correct  
the following, in case of errors.]


Le 24 sept. 06 à 19:49, Rowland McDonnell a écrit :

> Cheers - I don't expect anything in particular from you, and any help
> you might be able to give will be welcome.  The question I *really*  
> want
> to crack at the moment is `What controls the search path(s) fmtutil  
> gets
> its inputs from?'

The search path of fmtutil is controlled by the form in which fmtutil  
is invoked, i.e. fmtutil or fmtutil-sys, and also by other mechanisms.

Both fmtutil-sys and fmtutil get input from the home directory of the  
user invoking them, and from all the TeX trees inside /usr/local/ 
teTeX/share (called "global trees" in TETEXDOC.pdf), yielding:

	~/Library/texmf
	/usr/local/teTeX/share/texmf.local
	/usr/local/teTeX/share/texmf.gwtex
	/usr/local/teTeX/share/texmf.tetex
	/usr/local/teTeX/share/texmf

For each file searched for, fmtutil and fmtutil-sys read the above  
directories in this order (from top to bottom), and stop reading at  
the first occurrence of the file.

fmtutil and fmtutil-sys write output to different places : fmtutil to  
the home directory, and fmtutil-sys to the directories specified by  
the variables TEXMFSYSCONFIG and TEXMFSYSVAR according to section 4.4  
of TETEXDOC.pdf. These variables are defined in /usr/local/teTeX/ 
texmf.cnf as VARTEXMF, defined in turn as TEXMFLOCAL, defined in turn  
as /usr/local/teTeX/share/texmf.local.

Now, because fmtutil-sys writes output to directories (inside /usr/ 
local/teTeX/) owned by root, and not writable by other users, it  
needs to be invoked through sudo, in order to get administrator  
privileges.

The use of sudo offers yet another possibility, namely either simple  
sudo so that fmutil-sys works as above, or "sudo -H" which makes  
fmtutil-sys think that the home directory is the home directory of  
root. According to the man page of sudo:

> sudo accepts the following command line options:
>
>        -H  The -H (HOME) option sets the HOME environment variable  
> to the
>            homedir of the target user (root by default) as  
> specified in
>            passwd(5).  By default, sudo does not modify HOME (see  
> set_home and
>            always_set_home in sudoers(5)).

which tells that, by default, sudo leaves the home directory  
unchanged while "sudo -H" switches to the home directory of root.

In practice, the home directory of root doesn't normally exist under  
Mac OS X. As a consequence, using "sudo -H" makes fmtutil-sys ignore  
~/Library/texmf and only read from /usr/local/teTeX/share/texmf.local  
etc. (in the following I'll write /usr/local/teTeX/share/texmf.local  
etc. for /usr/local/teTeX/share/texmf.local then /usr/local/teTeX/ 
share/texmf.gwtex then /usr/local/teTeX/share/texmf.tetex then /usr/ 
local/teTeX/share/texmf).

So, in short, the situation is as follows:

sudo -H fmtutil-sys --all: reads input from /usr/local/teTeX/share/ 
texmf.local etc., and writes output to /usr/local/teTeX/share/ 
texmf.local.

sudo fmtutil-sys --all: reads input from ~/Library/texmf then /usr/ 
local/teTeX/share/texmf.local etc., and writes output to /usr/local/ 
teTeX/share/texmf.local.

fmtutil --all: reads input from ~/Library/texmf then /usr/local/teTeX/ 
share/texmf.local etc., and writes output to ~/Library/texmf.

Not to be used:

fmtutil-sys --all: won't work (won't be able to write its output).

sudo fmtutil --all: don't use (will write root-owned files in your  
home directory).

sudo -H fmtutil --all: don't use (might -- I haven't tried -- end up  
creating a root home directory to write its output to, which is  
generally unwanted).

The advantage of using fmtutil-sys instead of fmtutil is that formats  
created inside /usr/local/teTeX/share/texmf.local can be used by all  
users of a Mac (TeX and friends -- tex, pdftex etc. -- all read  
inside /usr/local/teTeX/share/texmf.local, independent from the user  
running them), while formats created inside ~/Library/texmf in the  
home directory of a given user can only be used by that particular user.

That's all for now, I hope it can be useful already,

Bruno------------------------- Info --------------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
          & FAQ: http://latex.yauh.de/faq/
TeX FAQ: http://www.tex.ac.uk/faq
List Archive: http://tug.org/pipermail/macostex-archives/




More information about the macostex-archives mailing list