fontforge/fontforge — pull request #1284 by mskala (2014-03-11 19:08:34+00:00)
Title: remove hardcoded "pfaedit" or "fontforge" name in shebang check

FontForge invoked with just a single filename will attempt to determine whether the file is a script (either language) or a font file by examining it for a shebang line, *regardless of whether the shebang mechanism was actually used to invoke FontForge*. This check will fail, causing FontForge to attempt to open the script file as a font, if it's a script whose shebang line does not explicitly mention one of the hardcoded names "pfaedit" or "fontforge." As a result, a correct shebang line pointing at FontForge will fail if FontForge's executable has been installed under a name other than one of those. The issue is particularly annoying in scripts, because it results in FontForge popping up GUI windows and demanding user interaction to acknowledge the error.

This change makes it recognize any shebang line at all as a script. It could be a problem if there is a font format whose first two bytes are '#!' and someone tries to open such a file on the command line, but it's unlikely that any such font formats exist, and I don't see a simpler way to get correct behaviour in the more usual case. The "-script" option is a better way to resolve the ambiguity where it can be used, but passing options to shebang interpreters isn't portable.