Default location of TEXMFLOCAL with alternate installation path

Karl Berry karl at freefriends.org
Sat Jun 11 00:08:45 CEST 2022


Hi Magnus - thanks for all the info.  I think the right patch is this
(line numbers will vary), sort-of inverting the sense of your change:

@@ -1407,8 +1463,9 @@
     if ($line =~ m/^TEXMFLOCAL\b/) { # don't find TEXMFLOCALEDIR
       # by default TEXMFLOCAL = TEXDIR/../texmf-local, if this is the case
       # we don't have to write a new setting.
-      my $deftmflocal = Cwd::abs_path($vars{'TEXDIR'}.'/../texmf-local');
-      if (Cwd::abs_path($vars{TEXMFLOCAL}) ne "$deftmflocal") {
+      my $deftmflocal = Cwd::abs_path($vars{'TEXDIR'}) . '/../texmf-local';
+      if (!defined $deftmflocal # in case abs_path couldn't resolve
+          || Cwd::abs_path($vars{TEXMFLOCAL}) ne "$deftmflocal") {
         push @changedtmf, "TEXMFLOCAL = $vars{'TEXMFLOCAL'}\n";
       }
     } elsif ($line =~ m/^TEXMFSYSVAR/) {


I've installed it (r63541), so it should show up in tonight's
install-tl.zip, etc.  Can you try it and see if it works? Fingers
crossed.

Explanation: what we're doing here is checking if the TEXMFLOCAL
directory value has been changed from the default.  If it has, we write
the new definition in texmf.cnf (that's texmf-dist/web2c/texmf.cnf).
If it is still the default, we do nothing.

So, since you have changed the value for TEXMFLOCAL, we want that new
value to be written to texmf.cnf.

The answer to "where are the directories created" is this line:
  make_local_skeleton "$vars{'TEXMFLOCAL'}";
which is part of do_installation, which is called before the code we are
discussing (in do_texmf_cnf, part of do_postinst_stuff, called further
down in do_installation. Probably more than you care to hear. :)

But we only want to create the directories that are requested.  That is,
with the directory value changed, we don't want to create the default
"$TEXDIR/../texmf-local" directory.  Hence abs_path returning undef is
expected, and we should consider TEXMFLOCAL to be a changed value for
texmf.cnf.

Thanks again for reporting, and tracking it down to the exact line!

Karl

P.S. Just for the record, at least for me, on non-Windows, abs_path
apparently returns undef when it has to traverse a nonexistent directory
level. For example,
  abs_path("/nonesuch")
  abs_path("nonesuch")
  abs_path("/tmp/nonesuch")
all return their argument, although those dirents do not exist. On the
other hand,
  abs_path("/nonesuch/.")
returns undef. Which actually seems to make some sort of sense :).

I suspect in principle we need to check for undef results from abs_path
in other places too.


More information about the tex-live mailing list.