Hi Deri, At 2025-06-11T02:20:31-0500, G. Branden Robinson wrote: > Re-sending, this time with a GPG signature. > > At 2025-06-10T15:39:06+0100, Deri wrote: > > One little quibble. Every font directory, either built-in path or > > GROFF_FONTPATH or -F flag can contain a download file, the new > > wording gives no indication which download file has the problem, > > once you know the particular download file involved and you find the > > entry for Symbol-Slanted it is that entry which needs correction, or > > the file it points to is not accessible. > > > > What do you think? > > Good point. I think I'll extend the `missing` hash to nest further > hashes tracking more data, including the filespec of the "download" > file with the troublesome entry.
I had put this on the shelf for a while, dealing with issues ramifying off of Savannah #67207, but now I'm back to it, and sure enough I swiftly managed to step on a land mine again. gropdf: warning: The download file in '/home/branden/src/GIT/groff/build/font/devpdf' has erroneous entry for 'Symbol-Slanted (SS)' That wasn't quite enough information to suit me. (I'm demanding of diagnostic messages. Among other things, I ask, "what's erroneous about it?".) With the attached patch, I get the following instead. gropdf:/home/branden/src/GIT/groff/build/font/devpdf/download:34:warning: cannot embed font file providing 'Symbol-Slanted' for groff font 'SS': '/home/branden/src/GIT/groff/build/font/devpdf/StandardSymSL.pfb' does not exist or is not readable That tells me everything I want to know. It tells me which *line* of the download file had the problem, sparing me the effort of searching the file (and possibly pointing out a problem of multiple entries), and the *file name* of the PDF font that resists embedding, *exactly where gropdf was looking for it*. Also the format of the message, since it involved a file being read and parsed, now conforms to the recommendation of the GNU Coding Standards. ---snip--- Error messages from other noninteractive programs should look like this: program:sourcefile:lineno: message when there is an appropriate source file, or like this: program: message when there is no relevant source file. ---end snip--- https://www.gnu.org/prep/standards/standards.html#Errors Ok to push this? Regards, Branden
diff --git a/src/devices/gropdf/gropdf.pl b/src/devices/gropdf/gropdf.pl index 6a83faf4d..861c1355c 100644 --- a/src/devices/gropdf/gropdf.pl +++ b/src/devices/gropdf/gropdf.pl @@ -1177,9 +1177,11 @@ sub LoadDownload OpenFile(\$f,$dir,"download"); next if !defined($f); $found++; + my $lineno=0; while (<$f>) { + $lineno++; chomp; s/#.*$//; next if $_ eq ''; @@ -1195,7 +1197,11 @@ sub LoadDownload if (!-r $pth) { - $missing{"$foundry $name"}="$dir/$devnm"; + $missing{"$foundry $name"}={ + DownloadFile => "$dir/$devnm/download", + LineNumber => "$lineno", + FontFile => "$pth" + }; next; } @@ -3177,6 +3183,13 @@ sub ParsePDFArray return($rtn); } +sub FileWarn { + my $fileName=shift; + my $lineNumber=shift; + my $message=shift; + print STDERR "$prog:$fileName:$lineNumber:warning: $message\n"; +} + sub Notice { if ($debug) @@ -3512,8 +3525,14 @@ sub LoadFont { if (exists($missing{$fontkey})) { - Warn("The download file in '$missing{$fontkey}' " - . " has erroneous entry for '$fnt{internalname} ($ofontnm)'"); + my %missingFont = %{$missing{$fontkey}}; + my $dlFile = $missingFont{DownloadFile}; + my $lineNo = $missingFont{LineNumber}; + my $fontFile = $missingFont{FontFile}; + FileWarn($dlFile, $lineNo, "cannot embed font file" + . " providing '$fnt{internalname}' for groff font" + . " '$ofontnm': '$fontFile' does not exist or is not" + . " readable"); } else {
signature.asc
Description: PGP signature