swiftlang / swift-package-manager

The Package Manager for the Swift Programming Language
Apache License 2.0
9.72k stars 1.34k forks source link

createBuildParametersFile() escapes build settings incorrectly #7902

Open jakepetroules opened 1 month ago

jakepetroules commented 1 month ago

Is it reproducible with SwiftPM command-line tools: swift build, swift test, swift package etc?

Description

The createBuildParametersFile() in XcodeBuildSystem.swift escapes build settings incorrectly. It's using spm_shellEscaped(), which is primarily intended for escaping strings for use in a command shell, but the build settings grammar is different, and escaping should be applied accordingly.

The current method will not handle characters such as \ and $ properly, which need to be -escaped, and escaping is also tricky in general because it depends on the type that the macro will ultimately be evaluated as (strings and string lists should be quoted differently).

Expected behavior

No response

Actual behavior

No response

Steps to reproduce

No response

Swift Package Manager version/commit hash

No response

Swift & OS version (output of swift --version ; uname -a)

No response