fix(main/boinc): disable /proc/stat check (#19967)

This commit is contained in:
Jia Yuan Lo 2024-04-27 17:09:29 +08:00 committed by GitHub
parent b24272d2b3
commit d01fc04d50
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
13 changed files with 52 additions and 47 deletions

View File

@ -1,6 +1,5 @@
diff -uNr boinc/_autosetup boinc.mod/_autosetup
--- boinc/_autosetup 2022-07-18 18:32:21.000000000 +0800
+++ boinc.mod/_autosetup 2022-09-11 21:07:04.995844110 +0800
--- a/_autosetup
+++ b/_autosetup
@@ -19,7 +19,7 @@
check_version()
{

View File

@ -5,7 +5,8 @@ TERMUX_PKG_MAINTAINER="@termux"
_MAJOR_VERSION=8
_MINOR_VERSION=0
TERMUX_PKG_VERSION="8.0.1"
TERMUX_PKG_SRCURL=https://github.com/BOINC/boinc/archive/client_release/${_MAJOR_VERSION}.${_MINOR_VERSION}/${TERMUX_PKG_VERSION}.tar.gz
TERMUX_PKG_REVISION=1
TERMUX_PKG_SRCURL=https://github.com/BOINC/boinc/archive/refs/tags/client_release/${_MAJOR_VERSION}.${_MINOR_VERSION}/${TERMUX_PKG_VERSION}.tar.gz
TERMUX_PKG_SHA256=db808f95a99ba0f27674ad7ea0a5f8b9ae027aa0cb5cc58bd731051a6ec928b0
TERMUX_PKG_DEPENDS="libandroid-execinfo, libandroid-shmem, libc++, libcurl, openssl, zlib"
TERMUX_PKG_NO_STATICSPLIT=true
@ -44,9 +45,10 @@ termux_pkg_auto_update() {
local major_version=$(echo "${latest_version}" | sed -E "s|([0-9]+).([0-9]+).([0-9]+)|\1|")
local minor_version=$(echo "${latest_version}" | sed -E "s|([0-9]+).([0-9]+).([0-9]+)|\2|")
sed -i "${TERMUX_PKG_BUILDER_DIR}/build.sh" \
sed \
-e "s|^_MAJOR_VERSION=.*|_MAJOR_VERSION=${major_version}|" \
-e "s|^_MINOR_VERSION=.*|_MINOR_VERSION=${minor_version}|"
-e "s|^_MINOR_VERSION=.*|_MINOR_VERSION=${minor_version}|" \
-i "${TERMUX_PKG_BUILDER_DIR}/build.sh"
termux_pkg_upgrade_version "${latest_version}" --skip-version-check
}

View File

@ -1,6 +1,5 @@
diff -uNr boinc/client/Makefile.am boinc.mod/client/Makefile.am
--- boinc/client/Makefile.am 2022-07-18 18:32:21.000000000 +0800
+++ boinc.mod/client/Makefile.am 2022-09-11 21:07:05.043844110 +0800
--- a/client/Makefile.am
+++ b/client/Makefile.am
@@ -139,12 +139,12 @@
boinc$(EXEEXT): boinc_client$(EXEEXT)

View File

@ -1,6 +1,5 @@
diff -uNr boinc/client/app_start.cpp boinc.mod/client/app_start.cpp
--- boinc/client/app_start.cpp 2022-07-18 18:32:21.000000000 +0800
+++ boinc.mod/client/app_start.cpp 2022-09-11 21:07:05.075844110 +0800
--- a/client/app_start.cpp
+++ b/client/app_start.cpp
@@ -81,6 +81,10 @@
#include "app.h"
@ -12,7 +11,7 @@ diff -uNr boinc/client/app_start.cpp boinc.mod/client/app_start.cpp
#ifdef _WIN32
// Dynamically link to these functions at runtime;
@@ -1117,6 +1121,49 @@
@@ -1125,6 +1129,49 @@
//
umask(2);
retval = execv(switcher_path, argv);
@ -62,7 +61,7 @@ diff -uNr boinc/client/app_start.cpp boinc.mod/client/app_start.cpp
} else {
argv[0] = buf;
parse_command_line(cmdline, argv+1);
@@ -1139,6 +1186,17 @@
@@ -1147,6 +1194,17 @@
);
}

View File

@ -1,6 +1,5 @@
diff -uNr boinc/client/gui_rpc_server_ops.cpp boinc.mod/client/gui_rpc_server_ops.cpp
--- boinc/client/gui_rpc_server_ops.cpp 2022-07-18 18:32:21.000000000 +0800
+++ boinc.mod/client/gui_rpc_server_ops.cpp 2022-09-11 21:07:05.111844109 +0800
--- a/client/gui_rpc_server_ops.cpp
+++ b/client/gui_rpc_server_ops.cpp
@@ -415,6 +415,7 @@
safe_strcpy(gstate.host_info.os_name, hi.os_name);
}

View File

@ -1,6 +1,5 @@
diff -uNr boinc/client/hostinfo_network.cpp boinc.mod/client/hostinfo_network.cpp
--- boinc/client/hostinfo_network.cpp 2022-07-18 18:32:21.000000000 +0800
+++ boinc.mod/client/hostinfo_network.cpp 2022-09-11 21:07:05.175844109 +0800
--- a/client/hostinfo_network.cpp
+++ b/client/hostinfo_network.cpp
@@ -44,6 +44,10 @@
#include <Carbon/Carbon.h>
#endif
@ -12,8 +11,8 @@ diff -uNr boinc/client/hostinfo_network.cpp boinc.mod/client/hostinfo_network.cp
#include "error_numbers.h"
#include "file_names.h"
#include "mac_address.h"
@@ -58,17 +62,29 @@
#include "hostinfo.h"
@@ -79,17 +83,29 @@
#endif
// get domain name and IP address of this host
-// Android: if domain_name is empty, set it to android_xxxxxxxx

View File

@ -1,6 +1,5 @@
diff -uNr boinc/client/hostinfo_unix.cpp boinc.mod/client/hostinfo_unix.cpp
--- boinc/client/hostinfo_unix.cpp 2023-01-24 04:47:18.000000000 +0800
+++ boinc.mod/client/hostinfo_unix.cpp 2023-03-18 07:57:32.603993049 +0800
--- a/client/hostinfo_unix.cpp
+++ b/client/hostinfo_unix.cpp
@@ -169,6 +169,16 @@
#include <OS.h>
#endif
@ -18,7 +17,7 @@ diff -uNr boinc/client/hostinfo_unix.cpp boinc.mod/client/hostinfo_unix.cpp
// Some OS define _SC_PAGE_SIZE instead of _SC_PAGESIZE
#if defined(_SC_PAGE_SIZE) && !defined(_SC_PAGESIZE)
#define _SC_PAGESIZE _SC_PAGE_SIZE
@@ -1499,7 +1509,12 @@
@@ -1505,7 +1515,12 @@
// return BOINC_SUCCESS if at least version could be found (extra_info may remain empty)
// return ERR_NOT_FOUND if ldd couldn't be opened or no version information was found
//
@ -32,7 +31,7 @@ diff -uNr boinc/client/hostinfo_unix.cpp boinc.mod/client/hostinfo_unix.cpp
int get_libc_version(string& version, string&) {
version = string(gnu_get_libc_version());
return BOINC_SUCCESS;
@@ -1549,16 +1564,24 @@
@@ -1555,16 +1570,24 @@
#if HAVE_SYS_UTSNAME_H
struct utsname u;
uname(&u);
@ -61,7 +60,7 @@ diff -uNr boinc/client/hostinfo_unix.cpp boinc.mod/client/hostinfo_unix.cpp
safe_strcpy(os_version, u.release);
#endif
#ifdef _HPUX_SOURCE
@@ -1711,7 +1734,7 @@
@@ -1717,7 +1740,7 @@
return false;
}
} tty_patterns[] = {

View File

@ -1,6 +1,5 @@
diff -uNr boinc/client/scripts/Makefile.am boinc.mod/client/scripts/Makefile.am
--- boinc/client/scripts/Makefile.am 2022-07-18 18:32:21.000000000 +0800
+++ boinc.mod/client/scripts/Makefile.am 2022-09-11 21:07:05.251844109 +0800
--- a/client/scripts/Makefile.am
+++ b/client/scripts/Makefile.am
@@ -2,21 +2,21 @@
install-exec-hook:

View File

@ -1,7 +1,6 @@
diff -uNr boinc/configure.ac boinc.mod/configure.ac
--- boinc/configure.ac 2022-07-18 18:32:21.000000000 +0800
+++ boinc.mod/configure.ac 2022-09-11 21:07:05.287844109 +0800
@@ -1100,7 +1100,7 @@
--- a/configure.ac
+++ b/configure.ac
@@ -1124,7 +1124,7 @@
AM_CONDITIONAL(OS_WIN32_MINGW, [echo $host_os | grep '^mingw' > /dev/null])
dnl or OS2
AM_CONDITIONAL(OS_OS2, [echo $host_os | grep '^os2' > /dev/null])
@ -9,4 +8,4 @@ diff -uNr boinc/configure.ac boinc.mod/configure.ac
+AM_CONDITIONAL(OS_ARM_LINUX, [echo $host_alias | grep '^arm-linux-skip' > /dev/null])
AM_CONDITIONAL(OS_ARMV6_LINUX, [echo $host_alias | grep '^armv6-linux' > /dev/null])
AM_CONDITIONAL(ANDROID, [test x"${ANDROID}" = xyes])
AM_CONDITIONAL(BUILD_WITH_VCPKG, [test "${enable_apps_vcpkg}" = yes])

View File

@ -1,8 +1,7 @@
diff -uNr boinc/lib/gui_rpc_client.cpp boinc.mod/lib/gui_rpc_client.cpp
--- boinc/lib/gui_rpc_client.cpp 2022-07-18 18:32:21.000000000 +0800
+++ boinc.mod/lib/gui_rpc_client.cpp 2022-09-11 21:07:05.339844109 +0800
--- a/lib/gui_rpc_client.cpp
+++ b/lib/gui_rpc_client.cpp
@@ -416,7 +416,7 @@
char msg_buf[1024];
char msg_buf[5120];
FILE* f = fopen(GUI_RPC_PASSWD_FILE, "r");
if (!f) {
-#if defined(__linux__)

View File

@ -1,7 +1,6 @@
diff -uNr boinc/lib/prefs.cpp boinc.mod/lib/prefs.cpp
--- boinc/lib/prefs.cpp 2022-07-18 18:32:21.000000000 +0800
+++ boinc.mod/lib/prefs.cpp 2022-09-11 21:07:05.387844109 +0800
@@ -221,7 +221,7 @@
--- a/lib/prefs.cpp
+++ b/lib/prefs.cpp
@@ -224,7 +224,7 @@
max_bytes_sec_down = 0;
max_bytes_sec_up = 0;
max_ncpus = 0;

View File

@ -0,0 +1,14 @@
--- a/lib/procinfo_unix.cpp
+++ b/lib/procinfo_unix.cpp
@@ -268,6 +268,11 @@
// see https://www.baeldung.com/linux/get-cpu-usage
//
double total_cpu_time() {
+#ifdef __ANDROID__
+// /proc/stat is inaccessible under modern Android
+// so always return 0 instead of spamming error
+ return 0;
+#endif
char buf[1024];
static FILE *f=NULL;
static double scale;

View File

@ -1,6 +1,5 @@
diff -uNr boinc/lib/synch.cpp boinc.mod/lib/synch.cpp
--- boinc/lib/synch.cpp 2022-07-18 18:32:21.000000000 +0800
+++ boinc.mod/lib/synch.cpp 2022-09-11 21:07:05.419844109 +0800
--- a/lib/synch.cpp
+++ b/lib/synch.cpp
@@ -18,7 +18,7 @@
// interfaces for accessing sempahores