[PATCH 2/2] configs: correctly terminate loop

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <pebolle@xxxxxxxxxx>
---
 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 a2ec3acb0423..846fe2e7095b 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"
 }
 
-- 
2.21.0
_______________________________________________
kernel mailing list -- kernel@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to kernel-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://getfedora.org/code-of-conduct.html
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/kernel@xxxxxxxxxxxxxxxxxxxxxxx




[Index of Archives]     [Fedora General Discussion]     [Older Fedora Users Archive]     [Fedora Advisory Board]     [Fedora Security]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Mentors]     [Fedora Package Announce]     [Fedora Package Review]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Coolkey]     [Yum Users]     [Tux]     [Yosemite News]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [USB]     [Asterisk PBX]

  Powered by Linux