aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXi Ruoyao <xry111@xry111.site>2023-11-13 21:00:03 +0800
committerXi Ruoyao <xry111@xry111.site>2023-11-13 21:00:03 +0800
commite70bf8f4f487b56276db09390949cd865bfca43e (patch)
treeae036bd5b215c72c3e1e8d734f0b7612eec13686
parent5196daeb4e36b321e42a8bec8302cad31c6ff690 (diff)
hostreqs: Bump Coreutils minimal version to 8.1 and check for nproc
We'll use nproc for setting MAKEFLAGS and TESTSUITEFLAGS. And if nproc is not available, we'll end up with "MAKEFLAGS=-j" which is very dangerous because it allows make to spawn infinite number of jobs. Check it early. The nproc program is added in Coreutils 8.1 so we need to bump the minimal version.
-rw-r--r--chapter02/hostreqs.xml15
1 files changed, 11 insertions, 4 deletions
diff --git a/chapter02/hostreqs.xml b/chapter02/hostreqs.xml
index 69533b9c7..63dcd943f 100644
--- a/chapter02/hostreqs.xml
+++ b/chapter02/hostreqs.xml
@@ -54,8 +54,9 @@
should be a link to bison or a small script that executes bison)</para>
</listitem>
+ <!-- In Coreutils-8.1 the nproc program is added. -->
<listitem>
- <para><emphasis role="strong">Coreutils-7.0</emphasis></para>
+ <para><emphasis role="strong">Coreutils-8.1</emphasis></para>
</listitem>
<listitem>
@@ -218,8 +219,8 @@ ver_kernel()
fi
}
-# Coreutils first because-sort needs Coreutils >= 7.0
-ver_check Coreutils sort 7.0 || bail "--version-sort unsupported"
+# Coreutils first because --version-sort needs Coreutils >= 7.0
+ver_check Coreutils sort 8.1 || bail "Coreutils too old, stop"
ver_check Bash bash 3.2
ver_check Binutils ld 2.13.1
ver_check Bison bison 2.7
@@ -259,7 +260,13 @@ echo "Compiler check:"
if printf "int main(){}" | g++ -x c++ -
then echo "OK: g++ works";
else echo "ERROR: g++ does NOT work"; fi
-rm -f a.out</literal>
+rm -f a.out
+
+if [ "$(nproc)" = "" ]; then
+ echo "ERROR: nproc is not available or it produces empty output"
+else
+ echo "OK: nproc reports $(nproc) logical cores are available"
+fi</literal>
EOF
bash version-check.sh</userinput></screen>