googlefonts / gftools

Misc tools for working with the Google Fonts library
Apache License 2.0
242 stars 71 forks source link

[Builder] sometimes fails at OTFautohint step because it tries to build `||` file #1004

Open arrowtype opened 1 month ago

arrowtype commented 1 month ago

I’m not really sure what’s happening here, but I’ve run into the same issue intermittently, so I wanted to report it. It only happens occasionally, and tends to sort itself out with a re-run, so it’s nothing super serious. But, it is a little confusing, and could be a problem worth solving.

Basically, it seems like the GF Builder will occasionally create a file called simply ||, then try to run it through the OTFautohint step. This doesn’t work, so it gives me the following error:

fontmake --output-path /tmp/tmpm2b7lj3i -o otf -u sources/ufo/instance_ufos/Familyname-Black.ufo.json --filter ... --filter FlattenComponentsFilter --filter DecomposeTransformedComponentsFilter
[24/31] autohintOTF
FAILED: /tmp/tmptz84cwqz 
/gftools/bin/python -m gftools.builder.jobrunner otfautohint  -o /tmp/tmptz84cwqz /tmp/tmpc31o27cq \|\| otfautohint  -o /tmp/tmptz84cwqz /tmp/tmpc31o27cq --no-zones-stems 

Command failed:
otfautohint -o /tmp/tmptz84cwqz /tmp/tmpc31o27cq || otfautohint -o /tmp/tmptz84cwqz /tmp/tmpc31o27cq --no-zones-stems

usage: otfautohint [-h] [-v]
                   [-g GLYPH_LIST | --glyphs-file PATH | -x GLYPH_LIST | --exclude-glyphs-file PATH]
                   [-m GLYPH_LIST | --overlaps-file PATH | --force-overlap | --force-no-overlap]
                   [--log PATH] [-p PROCESSES] [--version] [--traceback]
                   [-o PATH [PATH ...]] [-r PATH] [-b PATH] [-a] [-w] [-k]
                   [-c | --report-only] [-d] [--no-flex] [--no-hint-sub]
                   [--no-zones-stems] [--fontinfo-file PATH]
                   [--ignore-fontinfo]
                   [--print-list-fddict | --print-all-fddict] [--doc-fontinfo]
                   [--info] [--max-segments MAX_SEGMENTS] [--test]
                   [FONT ...]
otfautohint: error: argument -o/--output: /fonts/Familyname/|| is not a valid path to write to.

This has happened for various different fonts, and it generally works itself out if I simply re-run the build. I’m not sure what causes it, but because it works out without any changes from me, I don’t think it’s an issue in my fonts or my config files. As a total guess, maybe it’s something like a race condition, or a random glitch of temporary file naming, or something similar and slightly unpredictable. I mostly just wanted to record it in case others run into this, or in case there’s an obvious solution.

I’m on gftools 0.9.61, and my current config file looks like this:

familyName: Familyname
buildSmallCap: false
buildStatic: true
buildVariable: false
buildWebfont: false
autohintOTF: true
autohintTTF: true
interpolate: true
outputDir: ./fonts
sources:
  - sources/ufo/Familyname.designspace
recipeProvider: googlefonts
recipe:
  fonts/variable/FamilynameVariable[wdth].ttf:
    - source: sources/ufo/Familyname.designspace
    - args: --filter ...  --filter FlattenComponentsFilter --filter DecomposeTransformedComponentsFilter
      operation: buildVariable
    - args: "fix-nonhinting $in $out"
      exe: "gftools"
      operation: exec
    - args: "../scripts/rename-fonts.py $in --new_name 'Familyname Variable' && cp $in $out"
      exe: "python3"
      operation: exec
simoncozens commented 1 month ago

Looks like a quoting problem.

arrowtype commented 1 month ago

Oh, that would make sense. Just to clarify: are you guessing that the quoting problem is in my config file, or in GFtools?

simoncozens commented 1 month ago

No, it's in gftools, we're passing a command to another command, and probably mucking up the shell quoting when we do so.

arrowtype commented 1 month ago

Okay, makes sense. Thanks for the quick response, and for the further explanation!

m4rc1e commented 1 month ago

@arrowtype could you test out #1007? If you have the repo on github, I can do it for you.