From c2034039e8971add8b06062ff76794218ed12329 Mon Sep 17 00:00:00 2001 From: CanbiZ <47820557+MickLesk@users.noreply.github.com> Date: Mon, 15 Dec 2025 15:22:32 +0100 Subject: [PATCH] fix(tools): prevent awk errors in setup_rust on restricted containers (#9985) Add error suppression and || true to awk commands that parse rustc version. Prevents 'Operation not permitted' errors in containers with restricted syscalls. --- misc/tools.func | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/misc/tools.func b/misc/tools.func index f27cc5fc7..cc2a5bee7 100644 --- a/misc/tools.func +++ b/misc/tools.func @@ -4424,7 +4424,7 @@ function setup_rust() { # Get currently installed version local CURRENT_VERSION="" if command -v rustc &>/dev/null; then - CURRENT_VERSION=$(rustc --version 2>/dev/null | awk '{print $2}') + CURRENT_VERSION=$(rustc --version 2>/dev/null | awk '{print $2}' 2>/dev/null) || true fi # Scenario 1: Rustup not installed - fresh install @@ -4443,7 +4443,8 @@ function setup_rust() { return 1 fi - local RUST_VERSION=$(rustc --version 2>/dev/null | awk '{print $2}') + local RUST_VERSION + RUST_VERSION=$(rustc --version 2>/dev/null | awk '{print $2}' 2>/dev/null) || true if [[ -z "$RUST_VERSION" ]]; then msg_error "Failed to determine Rust version" return 1 @@ -4474,7 +4475,8 @@ function setup_rust() { # Ensure PATH is updated for current shell session export PATH="$CARGO_BIN:$PATH" - local RUST_VERSION=$(rustc --version 2>/dev/null | awk '{print $2}') + local RUST_VERSION + RUST_VERSION=$(rustc --version 2>/dev/null | awk '{print $2}' 2>/dev/null) || true if [[ -z "$RUST_VERSION" ]]; then msg_error "Failed to determine Rust version after update" return 1