From c14a577dc896409a708584fc6210793e7764fd39 Mon Sep 17 00:00:00 2001 From: Red Bear OS Date: Thu, 16 Jul 2026 18:57:53 +0900 Subject: [PATCH] init(00_tmp): idempotent mkdir -p, drop rm that failed on fresh boot --- init.d/00_tmp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/init.d/00_tmp b/init.d/00_tmp index f3e7a33ffb..d5281e4f71 100644 --- a/init.d/00_tmp +++ b/init.d/00_tmp @@ -1,4 +1,10 @@ -# FIXME change this to a service unit -# clear and recreate tmpdir with 0o1777 permission -rm -rf /tmp -mkdir -m a=rwxt /tmp +# Ensure the tmpdir exists with sticky 0o1777 permission. +# +# init runs each line as a standalone Oneshot command (no shell), so we cannot +# `rm -rf /tmp || true`. The previous `rm -rf /tmp` followed by a bare +# `mkdir /tmp` broke on a fresh boot: Redox's uutils `rm -f` errors on a +# missing operand ("cannot remove '/tmp': No such file or directory") — which +# POSIX says -f must ignore — and the subsequent non-`-p` mkdir then errors if +# /tmp already exists. A live boot has a fresh ramfs /tmp with nothing to +# clean, so just create it idempotently; `mkdir -p` is a no-op when present. +mkdir -p -m a=rwxt /tmp