texlive[48129] Master/texmf-dist/scripts/texlive/fmtutil.pl:

commits+karl at tug.org commits+karl at tug.org
Wed Jul 4 00:15:39 CEST 2018


Revision: 48129
          http://tug.org/svn/texlive?view=revision&revision=48129
Author:   karl
Date:     2018-07-04 00:15:38 +0200 (Wed, 04 Jul 2018)
Log Message:
-----------
(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

Modified Paths:
--------------
    trunk/Master/texmf-dist/scripts/texlive/fmtutil.pl

Modified: trunk/Master/texmf-dist/scripts/texlive/fmtutil.pl
===================================================================
--- trunk/Master/texmf-dist/scripts/texlive/fmtutil.pl	2018-07-03 21:03:18 UTC (rev 48128)
+++ trunk/Master/texmf-dist/scripts/texlive/fmtutil.pl	2018-07-03 22:15:38 UTC (rev 48129)
@@ -909,6 +909,8 @@
   @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,8 +952,9 @@
   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 ];
@@ -958,19 +961,37 @@
   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, at 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;



More information about the tex-live-commits mailing list