From fb2bf88a8477fb36474bf7158b91589516cf33c1 Mon Sep 17 00:00:00 2001 From: Martin Roth Date: Wed, 31 Aug 2022 20:42:50 -0600 Subject: 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 Change-Id: I3dacf1968ed897a8ebd00f95583c2f254a7fb55a Reviewed-on: https://review.coreboot.org/c/coreboot/+/67263 Tested-by: build bot (Jenkins) Reviewed-by: Felix Held --- Makefile.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Makefile.inc') diff --git a/Makefile.inc b/Makefile.inc index 0dd4864e20..0ed205fb41 100644 --- a/Makefile.inc +++ b/Makefile.inc @@ -153,7 +153,7 @@ int-gt=$(if $(filter 1,$(words $1)),$(strip $1),$(shell expr $(call _toint,$(wor 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' '_') -- cgit v1.2.3