From e845f911773296b2a2343290e9c2a39b99516915 Mon Sep 17 00:00:00 2001 From: Muaz Kadan <32595066+muazkadan@users.noreply.github.com> Date: Sat, 10 Oct 2026 21:39:30 +0300 Subject: [PATCH] =?UTF-8?q?Fix=20CPU=20temperature=20showing=200=C2=B0C=20?= =?UTF-8?q?in=20the=20performance=20overlay=20(#516)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since the proot speed-up in #494, the overlay couldn't find the CPU sensor and showed 0°C. It shows the real temperature again. --- tools/proot/fastpath/fastpath.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/tools/proot/fastpath/fastpath.c b/tools/proot/fastpath/fastpath.c index 4ac34b8a4..a49703192 100644 --- a/tools/proot/fastpath/fastpath.c +++ b/tools/proot/fastpath/fastpath.c @@ -467,6 +467,19 @@ static void remember(const char *literal, unsigned h, const char *guest) { pthread_mutex_unlock(&cache_lock); } +/* + * A binding below a symlink: proot canonicalised its guest path when it set it up + * (initialize_binding), so -b X:/sys/class/thermal/thermal_zone1/type binds the link's target, + * /sys/devices/virtual/thermal/thermal_zone1/type, and a path through the link meets it there. + * Known here by its literal text only, it would be missed; such a path is left to proot. + */ +static int binding_below(const char *g) { + size_t len = strlen(g); + for (int i = 0; i < nbinds; i++) + if (binds[i].glen > len && under(binds[i].guest, g, len)) return 1; + return 0; +} + /* ---------------------------------------------------------------- resolution */ /* @@ -650,7 +663,7 @@ static long walk(struct res *r, const char *text, int follow, int last) { if (S_ISLNK(r->st.st_mode) && (!final || follow)) { char target[PATH_MAX]; long t; - if (++links > MAX_LINKS) return FP_SLOW; + if (++links > MAX_LINKS || binding_below(r->guest)) return FP_SLOW; if (under(r->guest, "/proc", 5)) { t = proc_link(r, target, final && last); if (t == FP_SLOW) return FP_SLOW;