From 926fa54ae13fabfe16919ad08d475865b1916ded Mon Sep 17 00:00:00 2001 From: Paul Bolle Date: Mon, 6 May 2019 11:01:04 +0200 Subject: [PATCH] configs: correctly terminate loop The switch_to_toplevel() function in process_configs.sh contains a buggy loop. It tests whether $path is empty but should test whether $path equals "/". (It repeatedly calls dirname on pwd's output, and since pwd will return an absolute path this will, eventually, return "/" forever.) So let's test for "/" here. Signed-off-by: Paul Bolle --- configs/process_configs.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configs/process_configs.sh b/configs/process_configs.sh index a2ec3acb0..846fe2e70 100755 --- a/configs/process_configs.sh +++ b/configs/process_configs.sh @@ -14,7 +14,7 @@ die() switch_to_toplevel() { path="$(pwd)" - while test -n "$path" + while test "$path" != "/" do test -e $path/MAINTAINERS && \ test -d $path/drivers && \ @@ -23,7 +23,7 @@ switch_to_toplevel() path="$(dirname $path)" done - test -n "$path" || die "Can't find toplevel" + test "$path" != "/" || die "Can't find toplevel" echo "$path" }