From fa6951f56b5d3dcc12df3039172d77c7fcfdb2f3 Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Tue, 20 Apr 2021 09:41:16 +0900 Subject: fmtutil: warn on first time user format dump --- Master/texmf-dist/scripts/texlive/fmtutil.pl | 37 +++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/Master/texmf-dist/scripts/texlive/fmtutil.pl b/Master/texmf-dist/scripts/texlive/fmtutil.pl index b740b21eb9c..ca2eac40259 100755 --- a/Master/texmf-dist/scripts/texlive/fmtutil.pl +++ b/Master/texmf-dist/scripts/texlive/fmtutil.pl @@ -60,6 +60,8 @@ my $sep = (win32() ? ';' : ':'); my @deferred_stderr; my @deferred_stdout; +my $first_time_creation_in_usermode = 0; + my $DRYRUN = ""; my $STATUS_FH; @@ -493,7 +495,35 @@ sub callback_build_formats { # try to remove the tmpdir with all files TeXLive::TLUtils::rmtree($tmpdir); } - # return + # + # In case of user mode and formats rebuilt, warn that these formats + # will shadow future updates. Can be suppressed with --quiet which + # does not show print_info output + if ($opts{'user'} && $suc && $first_time_creation_in_usermode) { + print_info(" +************************************************************* +* * +* WARNING: you are switching to fmtutil's per-user formats. * +* Please read the following explanations. * +* * +************************************************************* + +You have run fmtutil-user (as opposed to fmtutil-sys) for the first time; this +has created format files which are local to your personal account. + +Any changes in system formats will *not* be automatically reflected in +your files; furthermore, running fmtutil-sys will no longer have any +effect for you. As a consequence, you have to rerun fmtutil-user yourself +after any change in the system directories. + +See http://tug.org/texlive/scripts-sys-user.html for details. + +If you want to undo this, remove the files mentioned above. + +(Run $prg --help for full documentation of fmtutil.) +"); + } + # return return $opts{"strict"} ? $err : 0; } @@ -786,8 +816,13 @@ sub rebuild_one_format { } my $destfile = "$destdir/$fmtfile"; + # set flag to warn that new user format was installed + # we check whether the next command **would** create a new file, + # and if it succeeded, we set the actual flag. + my $possibly_warn = ($opts{'user'} && ! -r $destfile); if (File::Copy::copy($fmtfile, $destfile )) { print_info("$destfile installed.\n"); + $first_time_creation_in_usermode = $possibly_warn; # # original fmtutil.sh did some magic trick for mplib-luatex.mem # -- cgit v1.2.3