aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2018-02-11 08:21:14 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2018-02-11 08:21:14 +0000
commite289699c12b060f7eb76040e876cc5c98366128b (patch)
treec75669fd7602753774c8113a2fd5f3a6761e2f2a
parent8167805987d65fc5dd9b24b8f69fef962a941c61 (diff)
parent934c2eef9e10831cdfd24a367acf6d4f50975603 (diff)
downloadplatform_build_kati-e289699c12b060f7eb76040e876cc5c98366128b.tar.gz
platform_build_kati-e289699c12b060f7eb76040e876cc5c98366128b.tar.bz2
platform_build_kati-e289699c12b060f7eb76040e876cc5c98366128b.zip
Snap for 4598635 from 934c2eef9e10831cdfd24a367acf6d4f50975603 to pi-release
Change-Id: Idce3fefe2e76af934b26146a2177780a8285356c
-rw-r--r--find.cc16
-rw-r--r--testcase/find_command.mk1
2 files changed, 11 insertions, 6 deletions
diff --git a/find.cc b/find.cc
index 1b9e23f..1bf0b9e 100644
--- a/find.cc
+++ b/find.cc
@@ -526,12 +526,16 @@ class FindCommandParser {
while (true) {
if (!GetNextToken(&tok))
return NULL;
- if (tok != "-and" && tok != "-a") {
- UngetToken(tok);
- return c.release();
+ if (tok == "-and" || tok == "-a") {
+ if (!GetNextToken(&tok) || tok.empty())
+ return NULL;
+ } else {
+ if (tok != "-not" && tok != "\\!" && tok != "\\(" && tok != "-name" &&
+ tok != "-type") {
+ UngetToken(tok);
+ return c.release();
+ }
}
- if (!GetNextToken(&tok) || tok.empty())
- return NULL;
unique_ptr<FindCond> r(ParseFact(tok));
if (!r.get()) {
return NULL;
@@ -562,7 +566,7 @@ class FindCommandParser {
}
// <expr> ::= <term> {<or> <term>}
- // <term> ::= <fact> {<and> <fact>}
+ // <term> ::= <fact> {[<and>] <fact>}
// <fact> ::= <not> <fact> | '\(' <expr> '\)' | <pred>
// <not> ::= '-not' | '\!'
// <and> ::= '-and' | '-a'
diff --git a/testcase/find_command.mk b/testcase/find_command.mk
index c3e8a07..b714879 100644
--- a/testcase/find_command.mk
+++ b/testcase/find_command.mk
@@ -67,6 +67,7 @@ endif
$(call run_find, find testdir -name "file1")
$(call run_find, find testdir -name "file1")
$(call run_find, find testdir -name "*1")
+ $(call run_find, find testdir -name "*1" -name "file*")
$(call run_find, find testdir -name "*1" -and -name "file*")
$(call run_find, find testdir -name "*1" -or -name "file*")
$(call run_find, find testdir -name "*1" -or -type f)