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

ninja: Use platform dependent quote instead of shlex.quote() in gcc_rsp_quote() #12647

Merged
merged 1 commit into from
Jan 9, 2024
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
20 changes: 9 additions & 11 deletions mesonbuild/backend/ninjabackend.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import os
import pickle
import re
import shlex
import subprocess
import typing as T

Expand Down Expand Up @@ -67,16 +66,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 +77,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
Loading