From 8d77acc0021c3f5bb5f94e5096e793da212e55f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timo=20R=C3=B6hling?= Date: Sun, 28 May 2023 13:14:00 +0200 Subject: [PATCH] Tolerate empty /proc/cpuinfo --- .../0002-Tolerate-empty-proc-cpuinfo.patch | 25 +++++++++++++++++++ debian/patches/series | 1 + 2 files changed, 26 insertions(+) create mode 100644 debian/patches/0002-Tolerate-empty-proc-cpuinfo.patch diff --git a/debian/patches/0002-Tolerate-empty-proc-cpuinfo.patch b/debian/patches/0002-Tolerate-empty-proc-cpuinfo.patch new file mode 100644 index 000000000..872d6fe71 --- /dev/null +++ b/debian/patches/0002-Tolerate-empty-proc-cpuinfo.patch @@ -0,0 +1,25 @@ +From: =?utf-8?q?Timo_R=C3=B6hling?= +Date: Sun, 28 May 2023 12:02:38 +0200 +Subject: Tolerate empty /proc/cpuinfo + +Forwarded: https://gitlab.kitware.com/utils/kwsys/-/merge_requests/284 + https://gitlab.kitware.com/cmake/cmake/-/merge_requests/8504 +--- + Source/kwsys/SystemInformation.cxx | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/Source/kwsys/SystemInformation.cxx b/Source/kwsys/SystemInformation.cxx +index 20e2edb..7f8485e 100644 +--- a/Source/kwsys/SystemInformation.cxx ++++ b/Source/kwsys/SystemInformation.cxx +@@ -3453,6 +3453,10 @@ bool SystemInformationImplementation::RetrieveInformationFromCpuInfoFile() + fileSize++; + } + fclose(fd); ++ if (fileSize < 2) { ++ std::cout << "No data in /proc/cpuinfo" << std::endl; ++ return false; ++ } + buffer.resize(fileSize - 2); + // Number of logical CPUs (combination of multiple processors, multi-core + // and SMT) diff --git a/debian/patches/series b/debian/patches/series index 812333042..4b99e2fcd 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -1 +1,2 @@ 0001-Prefer-default-Python-version.patch +0002-Tolerate-empty-proc-cpuinfo.patch