summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/scripts
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2018-07-03 22:15:38 +0000
committerKarl Berry <karl@freefriends.org>2018-07-03 22:15:38 +0000
commit811efe80bf8a88d2f9649a5d20a83c41744339a6 (patch)
treec9252d7f53154941ccf1d46ee4c6096bc14ad0de /Master/texmf-dist/scripts
parent8c9a7e8d27678930da67f9e032683c72a5a58699 (diff)
(callback_list_cfg): return success unless there
were no lines at all. (read_fmtutil_file): ignore fmtutil.cnf lines unless they have an engine, pattern file, and inifile (as well as a format name), else Perl undef warnings ensue. http://tug.org/mailman/private/mactex/2018-March/009899.html git-svn-id: svn://tug.org/texlive/trunk@48129 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/scripts')
-rwxr-xr-xMaster/texmf-dist/scripts/texlive/fmtutil.pl29
1 files changed, 25 insertions, 4 deletions
diff --git a/Master/texmf-dist/scripts/texlive/fmtutil.pl b/Master/texmf-dist/scripts/texlive/fmtutil.pl
index 681d9908ff2..beaedd33c32 100755
--- a/Master/texmf-dist/scripts/texlive/fmtutil.pl
+++ b/Master/texmf-dist/scripts/texlive/fmtutil.pl
@@ -909,6 +909,8 @@ sub callback_list_cfg {
@lines = map { $_->[1] } sort { $a->[0] cmp $b->[0] } @lines;
print "List of all formats:\n";
print @lines;
+
+ return @lines == 0; # only return failure if no formats.
}
@@ -950,27 +952,46 @@ sub read_fmtutil_file {
my $fn = shift;
open(FN, "<$fn") || die "Cannot read $fn: $!";
#
- # we count lines from 0 ..!!!!
+ # we count lines from 0 ..!!!!?
my $i = -1;
+ my $printline = 0; # but not in error messages
my @lines = <FN>;
chomp(@lines);
$alldata->{'fmtutil'}{$fn}{'lines'} = [ @lines ];
close(FN) || warn("$prg: Cannot close $fn: $!");
for (@lines) {
$i++;
+ $printline++;
chomp;
+ my $orig_line = $_;
next if /^\s*#?\s*$/; # ignore empty and all-blank and just-# lines
next if /^\s*#[^!]/; # ignore whole-line comment that is not a disable
s/#[^!].*//; # remove within-line comment that is not a disable
s/#$//; # remove # at end of line
my ($a,$b,$c,@rest) = split (' '); # special split rule, leading ws ign
+ if (! $b) { # as in: "somefmt"
+ print_warning("no engine specified for format $a, ignoring "
+ . "(file $fn, line $printline)\n");
+ next;
+ }
+ if (! $c) { # as in: "somefmt someeng"
+ print_warning("no pattern argument specified for $a/$b, ignoring line: "
+ . "$orig_line (file $fn, line $printline)\n");
+ next;
+ }
+ if (@rest == 0) { # as in: "somefmt someeng somepat"
+ print_warning("no inifile argument(s) specified for $a/$b, ignoring line: "
+ . "$orig_line (file $fn, line $printline)\n");
+ next;
+ }
my $disabled = 0;
if ($a eq "#!") {
- # we cannot determine whether a line is a proper fmtline or
- # not, so we have to assume that it is
+ # we cannot feasibly determine whether a line is a proper fmtline or
+ # not, so we have to assume that it is as long as we have four args.
my $d = shift @rest;
if (!defined($d)) {
- print_warning("apparently not a real disable line, ignored: $_\n");
+ print_warning("apparently not a real disable line, ignoring: "
+ . "$orig_line (file $fn, line $printline)\n");
next;
} else {
$disabled = 1;