[tex-live] ls-R files and nasty symlinks

Nelson H. F. Beebe beebe at math.utah.edu
Sat Oct 18 01:01:27 CEST 2014

We recently noticed unexpected fileserver loads, and tracked down the
cause: creation of TeX Live ls-R file in user directory trees when
their trees contain a file that is a symlink to the root of the
filesystem, /.  

In our case, the filesystem contains about 100TB of space, and the
root / may contain mount points for 30 or so other filesystems.  The
result is a huge delay in creating the ls-R files, and those are big:
tens of MB, or even larger (we killed off the offending mktexlsr
processes before they completed).

You might wonder how symlinks to / get created.  Here are two examples
from widely-used software:


In both cases, z: is a symbolic link to `/'.  A scan of our filesystem
found about 120 such instances among our thousands of users, and about
100 ls-R files in user directories.

Examination of texlive/YYYY/bin/ARCH/mktexlsr shows that it is a shell
script of about 220 lines, and it appears that the file listing is
made by this command at line 203 of the 2014 mktexlsr script, which is
identical across all platforms within a given year:

	(cd "$TEXMFLS_R" && \ls -LRa 2>/dev/null) \

The problem is the -L option, which according to the Solaris manual
page for ls works like this:

     -L           If an argument is a symbolic link, this  option
                  evaluates the file information and file type of
                  the file or directory that the link references,
                  rather  than those of the link itself. However,
                  the name of the link is displayed, rather  than
                  the referenced file or directory.

Unlike the Unix "find" command that might have been used for the job
(although the output would need further processing to make it look
like the current ls-R format), "ls" has no options like "find"'s
-mount or -xdev, which prevent descents into directories on other

Does anyone have an idea how we might prevent mktexlsr from spending
large amounts of time listing files that are outside the user's
personal tree?

Removing the -L option would do that, but that is a change with a big
enough effect that it could foil TeX Live user expectations at many

- Nelson H. F. Beebe                    Tel: +1 801 581 5254                  -
- University of Utah                    FAX: +1 801 581 4148                  -
- Department of Mathematics, 110 LCB    Internet e-mail: beebe at math.utah.edu  -
- 155 S 1400 E RM 233                       beebe at acm.org  beebe at computer.org -
- Salt Lake City, UT 84112-0090, USA    URL: http://www.math.utah.edu/~beebe/ -

More information about the tex-live mailing list