Skip to content

Commit

Permalink
ninja: Use platform dependent quote instead of shlex.quote() in gcc_r…
Browse files Browse the repository at this point in the history
…sp_quote()
  • Loading branch information
byteblob42 authored Dec 20, 2023
1 parent 0c3e84b commit 6ae4fb8
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions mesonbuild/backend/ninjabackend.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,16 +67,6 @@ def cmd_quote(arg: str) -> str:

return arg

def gcc_rsp_quote(s: str) -> str:
# see: the function buildargv() in libiberty
#
# this differs from sh-quoting in that a backslash *always* escapes the
# following character, even inside single quotes.

s = s.replace('\\', '\\\\')

return shlex.quote(s)

# How ninja executes command lines differs between Unix and Windows
# (see https://ninja-build.org/manual.html#ref_rule_command)
if mesonlib.is_windows():
Expand All @@ -88,6 +78,15 @@ def gcc_rsp_quote(s: str) -> str:
execute_wrapper = []
rmfile_prefix = ['rm', '-f', '{}', '&&']

def gcc_rsp_quote(s: str) -> str:
# see: the function buildargv() in libiberty
#
# this differs from sh-quoting in that a backslash *always* escapes the
# following character, even inside single quotes.

s = s.replace('\\', '\\\\')

return quote_func(s)

def get_rsp_threshold() -> int:
'''Return a conservative estimate of the commandline size in bytes
Expand Down

0 comments on commit 6ae4fb8

Please sign in to comment.