Skip to content

Commit 6bf9922

Browse files
authored
generator: Quote paths passed to container image extraction commands (#178)
Some paths were being passed to container extraction commands (tar, docker cp) without quotes. This caused the extraction to fail if the paths contained spaces.
1 parent f75817c commit 6bf9922

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

Sources/SwiftSDKGenerator/Generator/SwiftSDKGenerator+Unpack.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,14 @@ extension SwiftSDKGenerator {
5959
if hostSwiftPackagePath.string.contains("tar.gz") {
6060
try await Shell.run(
6161
#"""
62-
tar -xzf \#(hostSwiftPackagePath) -C "\#(pathsConfiguration.toolchainDirPath)" -x \#(excludes.joined(separator: " ")) --strip-components=1
62+
tar -xzf "\#(hostSwiftPackagePath)" -C "\#(pathsConfiguration.toolchainDirPath)" -x \#(excludes.joined(separator: " ")) --strip-components=1
6363
"""#,
6464
shouldLogCommands: isVerbose
6565
)
6666
} else {
6767
try await Shell.run(
6868
#"""
69-
tar -x --to-stdout -f \#(hostSwiftPackagePath) \*.pkg/Payload |
69+
tar -x --to-stdout -f "\#(hostSwiftPackagePath)" \*.pkg/Payload |
7070
tar -C "\#(pathsConfiguration.toolchainDirPath)" -x \#(excludes.joined(separator: " ")) --include usr
7171
"""#,
7272
shouldLogCommands: isVerbose

Sources/SwiftSDKGenerator/Generator/SwiftSDKGenerator.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ public actor SwiftSDKGenerator {
118118
else { return }
119119
}
120120
try await Shell.run(
121-
"\(Self.dockerCommand) cp \(id):\(containerPath) - | tar x -C \(localPath.removingLastComponent())",
121+
#"\#(Self.dockerCommand) cp \#(id):\#(containerPath) - | tar x -C "\#(localPath.removingLastComponent())""#,
122122
shouldLogCommands: self.isVerbose
123123
)
124124
}

0 commit comments

Comments
 (0)