Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[autohint] Enclose the AUTOHINTEXE path in quotes #654

Merged
merged 1 commit into from
Oct 23, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions python/afdko/autohint.py
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,7 @@ def CheckEnvironment():
logMsg("Please re-install the FDK. The path to the program 'tx' is not in the environment variable PATH.")
raise FDKEnvironmentError

command = AUTOHINTEXE + " -u 2>&1"
command = '"%s" -u 2>&1' % AUTOHINTEXE
report = fdkutils.runShellCmd(command)
if "version" not in report:
logMsg("Please re-install the FDK. The path to the program 'autohintexe' is not in the environment variable PATH.")
Expand Down Expand Up @@ -656,13 +656,13 @@ def getOptions():

if arg == "-h":
print(__help__)
command = AUTOHINTEXE + " -v"
command = '"%s" -v' % AUTOHINTEXE
report = fdkutils.runShellCmd(command)
logMsg( report)
raise ACOptionParseError
elif arg == "-u":
print(__usage__)
command = AUTOHINTEXE + " -v"
command = '"%s" -v' % AUTOHINTEXE
report = fdkutils.runShellCmd(command)
logMsg( report)
raise ACOptionParseError
Expand Down Expand Up @@ -1237,7 +1237,7 @@ def hintFile(options):
else:
if os.path.exists(tempBezNew):
os.remove(tempBezNew)
command = AUTOHINTEXE + " %s%s%s%s -s %s -f \"%s\" \"%s\"" % (verboseArg, suppressEditArg, supressHintSubArg, decimalArg, NEWBEZ_SUFFIX, tempFI, tempBez)
command = '"%s" %s%s%s%s -s %s -f "%s" "%s"' % (AUTOHINTEXE, verboseArg, suppressEditArg, supressHintSubArg, decimalArg, NEWBEZ_SUFFIX, tempFI, tempBez)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you called the subprocess with a list of strings instead a single string, then subprocess would take care of the quoting for you

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

autohint.py is on the chopping block

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and fdkutils.runShellCmd is used in many places; any changes to it need to be done carefully.

if options.debug:
print(command)
report = fdkutils.runShellCmd(command)
Expand Down