Fix WriteFileRule escaping
WriteFileRule shouldn't force the caller to ninja escape the input, and should shell escape spaces. Bug: 182612695 Test: manual Change-Id: Ide2f1ed92783eef7883279238de209d992d8f735
This commit is contained in:
@@ -145,7 +145,7 @@ var (
|
|||||||
|
|
||||||
func buildWriteFileRule(ctx BuilderContext, outputFile WritablePath, content string) {
|
func buildWriteFileRule(ctx BuilderContext, outputFile WritablePath, content string) {
|
||||||
content = echoEscaper.Replace(content)
|
content = echoEscaper.Replace(content)
|
||||||
content = proptools.ShellEscape(content)
|
content = proptools.NinjaEscape(proptools.ShellEscapeIncludingSpaces(content))
|
||||||
if content == "" {
|
if content == "" {
|
||||||
content = "''"
|
content = "''"
|
||||||
}
|
}
|
||||||
|
@@ -537,7 +537,7 @@ func (r *RuleBuilder) Build(name string, desc string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Create a rule to write the manifest as a the textproto.
|
// Create a rule to write the manifest as a the textproto.
|
||||||
WriteFileRule(r.ctx, r.sboxManifestPath, proptools.NinjaEscape(proto.MarshalTextString(&manifest)))
|
WriteFileRule(r.ctx, r.sboxManifestPath, proto.MarshalTextString(&manifest))
|
||||||
|
|
||||||
// Generate a new string to use as the command line of the sbox rule. This uses
|
// Generate a new string to use as the command line of the sbox rule. This uses
|
||||||
// a RuleBuilderCommand as a convenience method of building the command line, then
|
// a RuleBuilderCommand as a convenience method of building the command line, then
|
||||||
|
Reference in New Issue
Block a user