olex2: do not preserve ownership when copying into PREFIX

First build failed in install: cp -a onto /opt/psi logs 'failed to
preserve ownership ... Permission denied' for every file (chown refused)
and exits non-zero, which tripped the die-guard although the copy itself
was fine. Use cp -r --preserve=mode,timestamps,links instead. Record the
pitfall in the new-module skill guardrails.
This commit is contained in:
duan_j committed 2026-10-16 17:26:28 +02:00
1 parent 514ef49dbb
commit 2b5bb570ca
2 files changed
+9 -1

No files matched your search

+4
View File
@@ -102,6 +102,10 @@ There is **no `--dry-run` and no `--check-mode`** — to sanity-check config/pat
`du -sh /opt/psi/MX/<name>/<version>` from a second shell; don't kill a healthy build.
- modbuild runs hooks with `pipefail` + `nounset`: `yes | cmd` fails (SIGPIPE) — use
`printf 'y\ny\n' | cmd`.
- **Never `cp -a` / `cp -p` into `$PREFIX`**: chown is refused on `/opt/psi`, so every
file logs `failed to preserve ownership ... Permission denied` and cp exits non-zero
(olex2 2026-10: 12k-line log, die-guard aborted a healthy copy). Use
`cp -r --preserve=mode,timestamps,links src/. "$PREFIX"/` (or tar pipe / `install`).
- modbuild has **no errexit in hooks**: a failed command scrolls by and the build still
prints "done", installing the modulefile over a broken PREFIX. Guard every critical
hook step with `|| std::die 42 "<what and how to recover>"` and end `install` with an
+5 -1
View File
@@ -38,7 +38,11 @@ pbuild::install() {
local -r src="${SRC_DIR}/olex2"
# 1. vendor tree, flat into $PREFIX (= BaseDir). Slow on /opt/psi: 12k files.
cp -a "${src}/." "${PREFIX}/" || std::die 42 "olex2: copying the vendor tree into ${PREFIX} failed"
# NOT `cp -a`: on /opt/psi chown is refused, so -a ends with thousands of
# "failed to preserve ownership ... Permission denied" and a non-zero exit
# (that killed the first build). Keep mode/timestamps/links only.
cp -r --preserve=mode,timestamps,links "${src}/." "${PREFIX}/" || \
std::die 42 "olex2: copying the vendor tree into ${PREFIX} failed"
# 2. zip loses nothing, but make sure the ELF binaries are executable and
# everything is world-readable on the shared install