[OpenWrt-Devel] [PATCH] include/scan.mk: Add -a argument to the grep to treat all Makefiles as a text file.

Martin Strbacka martin.strbacka at nic.cz
Wed May 13 11:58:39 EDT 2015


Hello,

I found out that in some rare cases grep can treat Makefile as a binary file. That happened to me on UTF-8 Gentoo if Makefile contained a character which was from extended ASCII table. 
Without this patch the output of the grep command in the $(FILELIST) target is not valid (contains line "Binary file matches") and following commands fail to create feed index file.

Best Regards,
Martin Strbacka

Signed-off-by: Martin Strbacka <martin.strbacka at nic.cz>
---
 include/scan.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/scan.mk b/include/scan.mk
index c2a8f7e..5af0359 100644
--- a/include/scan.mk
+++ b/include/scan.mk
@@ -55,7 +55,7 @@ endif
 
 $(FILELIST): $(OVERRIDELIST)
 	rm -f $(TMP_DIR)/info/.files-$(SCAN_TARGET)-*
-	$(call FIND_L, $(SCAN_DIR)) $(SCAN_EXTRA) -mindepth 1 $(if $(SCAN_DEPTH),-maxdepth $(SCAN_DEPTH)) -name Makefile | xargs grep -HE 'call $(GREP_STRING)' | sed -e 's#^$(SCAN_DIR)/##' -e 's#/Makefile:.*##' | uniq | awk -v of=$(OVERRIDELIST) -f include/scan.awk > $@
+	$(call FIND_L, $(SCAN_DIR)) $(SCAN_EXTRA) -mindepth 1 $(if $(SCAN_DEPTH),-maxdepth $(SCAN_DEPTH)) -name Makefile | xargs grep -aHE 'call $(GREP_STRING)' | sed -e 's#^$(SCAN_DIR)/##' -e 's#/Makefile:.*##' | uniq | awk -v of=$(OVERRIDELIST) -f include/scan.awk > $@
 
 $(TMP_DIR)/info/.files-$(SCAN_TARGET).mk: $(FILELIST)
 	( \
-- 
1.9.1
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list