From fa5a3bb748fdde0210e90c6cb43f8557d4c0369e Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Wed, 21 Apr 2021 11:32:31 +0900 Subject: fmtutil: warn on shadowing formats --- Master/texmf-dist/scripts/texlive/fmtutil.pl | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Master/texmf-dist/scripts/texlive/fmtutil.pl b/Master/texmf-dist/scripts/texlive/fmtutil.pl index ca2eac40259..3882fc2a87e 100755 --- a/Master/texmf-dist/scripts/texlive/fmtutil.pl +++ b/Master/texmf-dist/scripts/texlive/fmtutil.pl @@ -587,12 +587,28 @@ sub select_and_rebuild_format { } } if ($doit) { + check_and_warn_on_user_format($fmt,$eng); return rebuild_one_format($fmt,$eng,$kpsefmt,$destdir,$fmtfile,$logfile); } else { return $FMT_NOTSELECTED; } } +sub check_and_warn_on_user_format { + my ($fmt, $eng) = @_; + # do nothing if we are updating files in $TEXMFVAR + return if ($opts{'fmtdir'} eq $TEXMFVAR); + my $saved_fmtdir = $opts{'fmtdir'}; + $opts{'fmtdir'} = "$TEXMFVAR/web2c"; + my ($kpsefmt, $destdir, $fmtfile, $logfile) = compute_format_destination($fmt, $eng); + if (-r "$destdir/$fmtfile") { + print_deferred_warning("you have a shadowing format dump in TEXMFVAR for $fmt/$eng!!!\n"); + } + $opts{'fmtdir'} = $saved_fmtdir; +} + + + # compute_format_destination # takes fmt/eng and returns the locations where format and log files # should be saved, that is, a list: (dump file full path, log file full path) -- cgit v1.2.3