<div dir="ltr"><div dir="ltr">Looks good to me.</div></div><br><div class="gmail_quote"><div dir="ltr">Le sam. 27 janv. 2018 à 11:41, Robert Mourning <<a href="mailto:robedmo.git@gmail.com">robedmo.git@gmail.com</a>> a écrit :<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">From: Robert Mourning <<a href="mailto:robedmo.git@gmail.com" target="_blank">robedmo.git@gmail.com</a>><br>
<br>
grep was interpreting the variables as regexes intended to<br>
match themselves. this could cause errors or false positives/negatives if the<br>
variables contain regex metacharacters. now the variables are escaped to<br>
produce regexes that will always and only match themselves.<br>
<br>
---<br>
compile.sh | 10 ++++++++--<br>
1 file changed, 8 insertions(+), 2 deletions(-)<br>
<br>
diff --git a/compile.sh b/compile.sh<br>
index 1fa14f9ae..8cfaa957c 100755<br>
--- a/compile.sh<br>
+++ b/compile.sh<br>
@@ -176,14 +176,20 @@ init_local_props() {<br>
echo_props > "$1"<br>
return 0<br>
fi<br>
+ # escape special chars to get regex that matches string<br>
+ make_regex() {<br>
+ echo "$1" | sed -e 's/\([[\^$.*]\)/\\\1/g' -<br>
+ }<br>
+ android_sdk_regex=`make_regex "${ANDROID_SDK}"`<br>
+ android_ndk_regex=`make_regex "${ANDROID_NDK}"`<br>
# check for lines setting the SDK directory<br>
sdk_line_start="^sdk\.dir="<br>
total_sdk_count=`grep -c "${sdk_line_start}" "$1"`<br>
- good_sdk_count=`grep -c "${sdk_line_start}${ANDROID_SDK}\$" "$1"`<br>
+ good_sdk_count=`grep -c "${sdk_line_start}${android_sdk_regex}\$" "$1"`<br>
# check for lines setting the NDK directory<br>
ndk_line_start="^ndk\.dir="<br>
total_ndk_count=`grep -c "${ndk_line_start}" "$1"`<br>
- good_ndk_count=`grep -c "${ndk_line_start}${ANDROID_NDK}\$" "$1"`<br>
+ good_ndk_count=`grep -c "${ndk_line_start}${android_ndk_regex}\$" "$1"`<br>
# if one of each is found and both match the environment vars, no action needed<br>
if [ "$total_sdk_count" -eq "1" -a "$good_sdk_count" -eq "1" \<br>
-a "$total_ndk_count" -eq "1" -a "$good_ndk_count" -eq "1" ]<br>
--<br>
2.15.1.windows.2<br>
<br>
_______________________________________________<br>
Android mailing list<br>
<a href="mailto:Android@videolan.org" target="_blank">Android@videolan.org</a><br>
<a href="https://mailman.videolan.org/listinfo/android" rel="noreferrer" target="_blank">https://mailman.videolan.org/listinfo/android</a><br>
</blockquote></div>