From 65f03f1408a610ad35ffc88b58f40ffb7dc236eb Mon Sep 17 00:00:00 2001 From: Dobroslaw Kijowski Date: Thu, 18 May 2017 12:35:02 +0200 Subject: [PATCH] extract_utils: fix extracting XML files containing binary characters When a line from the XML file contains a character which grep classifies as a binary one, it will omit this line at all. Moreover it will append 'Binary file matches' to the stdout. This behavior breaks some XML files. To fix this issue, let's tell grep to process a binary file as if it were text. Change-Id: I6ec5689f73a0926870e502f3f8ee77346b47d05f --- build/tools/extract_utils.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/tools/extract_utils.sh b/build/tools/extract_utils.sh index a6239cee..11819f3e 100644 --- a/build/tools/extract_utils.sh +++ b/build/tools/extract_utils.sh @@ -768,8 +768,8 @@ function fix_xml() { local XML="$1" local TEMP_XML="$TMPDIR/`basename "$XML"`.temp" - grep '^ "$TEMP_XML" - grep -v '^> "$TEMP_XML" + grep -a '^ "$TEMP_XML" + grep -av '^> "$TEMP_XML" mv "$TEMP_XML" "$XML" }