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