bug-groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug #62150] [afmtodit] should not write full file names to "name" direc


From: G. Branden Robinson
Subject: [bug #62150] [afmtodit] should not write full file names to "name" directive of font descriptions
Date: Mon, 7 Mar 2022 17:24:39 -0500 (EST)

URL:
  <https://savannah.gnu.org/bugs/?62150>

                 Summary: [afmtodit] should not write full file names to
"name" directive of font descriptions
                 Project: GNU troff
            Submitted by: gbranden
            Submitted on: Mon 07 Mar 2022 10:24:38 PM UTC
                Category: Device grops
                Severity: 3 - Normal
              Item Group: Incorrect behaviour
                  Status: In Progress
                 Privacy: Public
             Assigned to: gbranden
             Open/Closed: Open
         Discussion Lock: Any
         Planned Release: None

    _______________________________________________________

Details:

Dave observed in bug #61423:

> A recent change -- I'm gonna go out on a limb and accuse September's commit
c0d1bb28, though I've not done before/after testing to confirm this -- now
prevents these files from loading, troff giving up with the error "font
description file name 'JR' does not match 'name' argument
'/full/path/to/JR'".

> (In my case, the /full/path/to/JR as specified in the font description file
did not match the actual full path of its final resting place; apparently I
used some tool to generate the file in a working directory, and this tool
encoded the full path of its working directory onto this line.  But even when
I updated the path to match the file's current location, it still failed with
the same error.)

That bug deals with deeper architectural stuff, but in the meantime, afmtodit
should not be writing anything but the "basename" as the name of the font.

Having now looked at the code, I suspect the fact that it wrote the full file
name was an oversight.


diff --git a/src/utils/afmtodit/afmtodit.pl b/src/utils/afmtodit/afmtodit.pl
index 73ae7c65f..5886c1ecc 100644
--- a/src/utils/afmtodit/afmtodit.pl
+++ b/src/utils/afmtodit/afmtodit.pl
@@ -421,8 +421,13 @@ foreach my $lig (sort keys %default_ligatures) {
 open(FONT, ">$outfile") || die "$prog: can't open '$outfile' for output:
$!\n";
 select(FONT);
 
-print("# This file has been generated with " .
-      "GNU afmtodit (groff) version @VERSION@\n");
+# Produce a short version number so noise from a Git build doesn't leak
+# into the generated files when we run this tool in "maintainer mode".
+my $short_version = "@VERSION@";
+$short_version =~ s/([0-9.]+)(rc[0-9]+).*/$1$2/;
+
+print("# This file was generated with " .
+      "GNU afmtodit (groff) version $short_version\n");
 print("#\n");
 print("#   $fullname\n") if defined $fullname;
 print("#   $version\n") if defined $version;
@@ -445,7 +450,10 @@ if ($opt_c) {
 
 print("\n");
 
-print("name $font\n");
+my $name = $font;
+$name =~ s@.*/@@;
+
+print("name $name\n");
 print("internalname $psname\n") if $psname;
 print("special\n") if $opt_s;
 printf("slant %g\n", $italic_angle) if $italic_angle != 0;





    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?62150>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]