Felix Held has submitted this change. ( https://review.coreboot.org/c/coreboot/+/67263 )
Change subject: Makefile.inc: Fix build hang if file-size is run on empty string ......................................................................
Makefile.inc: Fix build hang if file-size is run on empty string
Currently, if for some reason, the file-size command is called on an empty string, the build will hang waiting for stdin input to cat. Since wc accepts a file, this cat was unnecessary anyway. Put the file name in quotes so an empty string will result in calling wc on an actual null file instead of just leaving the filename blank. This results in an error, and will probably halt the build.
BUG=214790407 TEST=Build default build.
Signed-off-by: Martin Roth martin.roth@amd.corp-partner.google.com Change-Id: I3dacf1968ed897a8ebd00f95583c2f254a7fb55a Reviewed-on: https://review.coreboot.org/c/coreboot/+/67263 Tested-by: build bot (Jenkins) no-reply@coreboot.org Reviewed-by: Felix Held felix-coreboot@felixheld.de --- M Makefile.inc 1 file changed, 24 insertions(+), 1 deletion(-)
Approvals: build bot (Jenkins): Verified Felix Held: Looks good to me, approved
diff --git a/Makefile.inc b/Makefile.inc index 0dd4864..0ed205f 100644 --- a/Makefile.inc +++ b/Makefile.inc @@ -153,7 +153,7 @@ int-eq=$(if $(filter 1,$(words $1)),$(strip $1),$(shell expr $(call _toint,$(word 1,$1)) = $(call _toint,$(word 2,$1)))) int-align=$(shell A=$(call _toint,$1) B=$(call _toint,$2); expr $$A + ( ( $$B - ( $$A % $$B ) ) % $$B ) ) int-align-down=$(shell A=$(call _toint,$1) B=$(call _toint,$2); expr $$A - ( $$A % $$B ) ) -file-size=$(strip $(shell cat $1 | wc -c)) +file-size=$(strip $(shell wc -c "$1" | cut -f 1 -d ' ')) tolower=$(shell echo '$1' | tr '[:upper:]' '[:lower:]') toupper=$(shell echo '$1' | tr '[:lower:]' '[:upper:]') ws_to_under=$(shell echo '$1' | tr ' \t' '_')