commit:     4a2587ce1a5e93a1066a9d9d9dafbe3846424977
Author:     Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Mon Jun  2 10:17:30 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Jun  5 11:22:05 2025 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=4a2587ce

isolated-functions.sh: have ___makeopts_jobs() strip leading zeroes

Ensure that leading zeroes are stripped from the value printed by the
__makeopts_jobs() function, thus helping to avoid the 'August' problem.

$ jobs=08
$ echo "$(( jobs + 1 ))"
-bash: 08: value too great for base (error token is "08")

Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 bin/isolated-functions.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bin/isolated-functions.sh b/bin/isolated-functions.sh
index 35b0e1cd2c..7760ba717f 100644
--- a/bin/isolated-functions.sh
+++ b/bin/isolated-functions.sh
@@ -499,7 +499,7 @@ ___makeopts_jobs() {
        
ere='.*[[:space:]](-[^j]*j[[:space:]]*|--jobs(=|[[:space:]]+))([0-9]+)[[:space:]]'
 
        if [[ " ${MAKEOPTS} " =~ $ere ]]; then
-               jobs=${BASH_REMATCH[3]}
+               jobs=$(( 10#${BASH_REMATCH[3]} ))
        elif jobs=$({ getconf _NPROCESSORS_ONLN || sysctl -n hw.ncpu; } 
2>/dev/null); then
                :
        else

Reply via email to