From 7cf55c3b7a2d9bcee87821e413fa322866f64c5b Mon Sep 17 00:00:00 2001 From: Trey Moen <50057480+greatgitsby@users.noreply.github.com> Date: Fri, 28 Aug 2026 22:11:52 -0700 Subject: [PATCH] common: fix OpenpilotPrefix cleanup on macOS (#38728) The destructor built its cleanup commands as "rm %s -rf", with the flags after the operand. GNU rm permutes arguments so this works on device and in CI, but BSD rm on macOS stops option parsing at the first operand and treats "-rf" as a second filename: $ mkdir -p /tmp/rmtest/sub && rm /tmp/rmtest -rf rm: /tmp/rmtest: is a directory rm: -rf: No such file or directory exit=1 So nothing is removed, and each of the four calls prints two errors plus "system command failed (256)" from check_system. Every run of a tool that owns an OpenpilotPrefix (replay, cabana) leaks its params dir, its comma_home and its /tmp/msgq_ dir; 33 of each had accumulated on my machine. Pass the flags first. --- openpilot/common/prefix.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/openpilot/common/prefix.h b/openpilot/common/prefix.h index 89f346b9e..0f2c59252 100644 --- a/openpilot/common/prefix.h +++ b/openpilot/common/prefix.h @@ -27,14 +27,14 @@ public: auto param_path = Params().getParamPath(); if (util::file_exists(param_path)) { std::string real_path = util::readlink(param_path); - util::check_system(util::string_format("rm %s -rf", real_path.c_str())); + util::check_system(util::string_format("rm -rf %s", real_path.c_str())); unlink(param_path.c_str()); } if (getenv("COMMA_CACHE") == nullptr) { - util::check_system(util::string_format("rm %s -rf", Path::download_cache_root().c_str())); + util::check_system(util::string_format("rm -rf %s", Path::download_cache_root().c_str())); } - util::check_system(util::string_format("rm %s -rf", Path::comma_home().c_str())); - util::check_system(util::string_format("rm %s -rf", msgq_path.c_str())); + util::check_system(util::string_format("rm -rf %s", Path::comma_home().c_str())); + util::check_system(util::string_format("rm -rf %s", msgq_path.c_str())); unsetenv("OPENPILOT_PREFIX"); }