Skip to content

Commit

Permalink
Add escapes to quotation marks in Java version detection genrule.
Browse files Browse the repository at this point in the history
Quotation mark character is significant for Win32's CreateProcess.
It should always be properly escaped when occuring inside arguments.

We might devise a common solution in GenRule for that, but for now
this change fixes the only genrule we use that runs into this issue.

Needed for #276.

--
MOS_MIGRATED_REVID=114881441
  • Loading branch information
dslomov authored and kchodorow committed Feb 17, 2016
1 parent fbf3cd2 commit cbbbf2e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ genrule(
outs = ["java.version"],
cmd = """
VERSION_LINE=$$(cat $< | grep target_version);
JAVA_VERSION=$$(echo $${VERSION_LINE} | sed 's/.*value="\\([^"]\\)".*/\\1/');
JAVA_VERSION=$$(echo $${VERSION_LINE} | sed 's/.*value=\\"\\([^\\"]\\)\\".*/\\1/');
if [ -z "$${JAVA_VERSION}" ]; then
echo "1.8" >$@ # Java 8 is the default
elif [[ "$${JAVA_VERSION}" =~ ^[0-9]+$$ ]]; then
Expand Down

0 comments on commit cbbbf2e

Please sign in to comment.