summaryrefslogtreecommitdiff
path: root/Makefile.inc
diff options
context:
space:
mode:
authorMartin Roth <martin.roth@amd.corp-partner.google.com>2022-08-31 20:42:50 -0600
committerFelix Held <felix-coreboot@felixheld.de>2022-09-06 15:48:53 +0000
commitfb2bf88a8477fb36474bf7158b91589516cf33c1 (patch)
tree997ad70e509e53252dbdb457240d5e8e27c8f0cc /Makefile.inc
parent21ddf55a4324ae616cd294b411023d73c3511bc6 (diff)
downloadcoreboot-fb2bf88a8477fb36474bf7158b91589516cf33c1.tar.gz
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>
Diffstat (limited to 'Makefile.inc')
-rw-r--r--Makefile.inc2
1 files changed, 1 insertions, 1 deletions
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' '_')