From d408beb505856c02bbae6121e29e4cb285077719 Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Sun, 9 May 2021 02:23:44 +0000 Subject: fmtutil and tlmgr improvements fmtutil.pl - if run as mktexfmt and TEXMFSYSVAR is writable, use it instead of TEXMFVAR (actual code in TLUtils.pm). - add --dry-run | -n option it is not guaranteed to be 100% dry-run, though - add --status-file=FILE where the status of each format creating is written to - warn on running fmtutil in user mode the first time (similar to updmap) - warn on shadowing formats - documentation fixes tlmgr.pl - use fmtutil --status-file and report back failed format rebuilds - regeneration all formats now only exists existing formats (use --refresh with fmtutil) - report when commands are logged to the respective log file - documentation fixes TLUtils.pm - update setup_sys_user_mode for the fmtutil/mktexfmt changes mentioned above - documentation fixes git-svn-id: svn://tug.org/texlive/trunk@59143 c570f23f-e606-0410-a88d-b1316a301751 --- Master/tlpkg/TeXLive/TLUtils.pm | 37 ++++++++++++++++++++++++++++++++++--- 1 file changed, 34 insertions(+), 3 deletions(-) (limited to 'Master/tlpkg/TeXLive/TLUtils.pm') diff --git a/Master/tlpkg/TeXLive/TLUtils.pm b/Master/tlpkg/TeXLive/TLUtils.pm index 0e68de0e011..128902db921 100644 --- a/Master/tlpkg/TeXLive/TLUtils.pm +++ b/Master/tlpkg/TeXLive/TLUtils.pm @@ -4585,7 +4585,11 @@ sub mktexupd { } -=item C +=item C + +Return two-element list C<($texmfconfig,$texmfvar)> of which directories +to use, either user or sys. If C<$prg> is C, and the system +dirs are writable, use them even if we are in user mode. =cut @@ -4613,7 +4617,8 @@ sub setup_sys_user_mode { exit(1); } if (!$optsref->{'sys'}) { - print STDERR "$prg [WARNING]: hidden sys mode found, switching to sys mode.\n" if (!$optsref->{'quiet'}); + print STDERR "$prg [WARNING]: hidden sys mode found, switching to sys mode.\n" + if (!$optsref->{'quiet'}); $optsref->{'sys'} = 1; } } @@ -4623,16 +4628,42 @@ sub setup_sys_user_mode { # we are running as updmap-sys, make sure that the right tree is used $texmfconfig = $TEXMFSYSCONFIG; $texmfvar = $TEXMFSYSVAR; + &debug("TLUtils::setup_sys_user_mode: sys mode\n"); + } elsif ($optsref->{'user'}) { $texmfconfig = $TEXMFCONFIG; $texmfvar = $TEXMFVAR; + &debug("TLUtils::setup_sys_user_mode: user mode\n"); + + # mktexfmt is run (accidentally or on purpose) by a user with + # missing formats; we want to put the resulting format dumps in + # TEXMFSYSVAR if possible, so that future format updates will just + # work. Until 2021, they were put in TEXMFVAR, causing problems. + # + # We only do this for mktexfmt, not fmtutil; if fmtutil is called + # explicitly with fmtutil -user, ok, do what they said to do. + # + if ($prg eq "mktexfmt") { + my $switchit = 0; + if (-d "$TEXMFSYSVAR/web2c") { + $switchit = 1 if (-w "$TEXMFSYSVAR/web2c"); + } elsif (-d $TEXMFSYSVAR && -w $TEXMFSYSVAR) { + $switchit = 1; + } + if ($switchit) { + $texmfvar = $TEXMFSYSVAR; + &ddebug(" switched to $texmfvar for mktexfmt\n"); + } + } } else { - print STDERR "" . + print STDERR "$prg [ERROR]: Either -sys or -user mode is required.\n" . "$prg [ERROR]: In nearly all cases you should use $prg -sys.\n" . "$prg [ERROR]: For special cases see https://tug.org/texlive/scripts-sys-user.html\n" ; exit(1); } + + &debug(" returning: ($texmfconfig,$texmfvar)\n"); return ($texmfconfig, $texmfvar); } -- cgit v1.2.3