Uh oh!
There was an error while loading. Please reload this page.
fix(#432): setup_log_file temp fallback so prepare-host never bare-fails on an NFS home - #512
Merged
Merged
Conversation
…isn't writable #432's documented core — running the network-FS guard before the log dir is created in the FULL install — already shipped in #441 (early_data_dir_guard runs before setup_log_file; validate_config before it only validates, never mkdirs). This closes the remaining path #441 didn't cover: prepare-host calls setup_log_file BEFORE any guard, and setup_log_file did a bare `mkdir -p "$HOST_DATA_DIR"` + tee — so on an NFS home under sudo + root_squash (the exact scenario #432 names) it failed with a cryptic error before any friendly message. setup_log_file now chooses its path via _choose_log_file: HOST_DATA_DIR when it's creatable AND writable, else a temp file (the scope's "start logging in a temp location" option) — so no install path dies on a bare mkdir/tee. The full install's early_data_dir_guard still refuses a network DATA dir before this runs, unchanged. (Also: the temp template uses trailing X's — BSD mktemp on macOS rejects a suffix after XXXXXX.) Tests: _choose_log_file returns a path under a writable HOST_DATA_DIR, and falls back to a temp path (never a bare failure) when the dir is uncreatable/unwritable. Closes#432
…ordering # Conflicts: # scripts/manifest.sha256
divyasinghds
approved these changes
Jul 31, 2026
Uh oh!
There was an error while loading. Please reload this page.
saadqbal
approved these changes
Jul 31, 2026
LukasWodka
commented
Aug 2, 2026
Contributor
/fr-pass |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#432 — network-FS guard runs before the log dir is created
Most of #432 already shipped in #441 (commit
dacba26, "run the network-FS guard before the log dir is created"):early_data_dir_guardnow runs beforesetup_log_filein the full install, andvalidate_config(before it) only validates — it never mkdirs. That path is done, with a#432 orderingtest already inpreflight.bats.This PR closes the one path #441 didn't cover:
prepare-host.main()callssetup_log_fileon the prepare-host branch before any guard, andsetup_log_filedid a baremkdir -p "$HOST_DATA_DIR"+tee. On an NFS home undersudo+root_squash— the exact scenario #432 names — that failed with a cryptic mkdir/tee error before any friendly message (or landed the lognobody-owned).Fix:
setup_log_filenow picks its path via a small, testable_choose_log_file—HOST_DATA_DIRwhen it's creatable and writable, else a temp file (the scope's "start logging in a temp location" option). No install path dies on a baremkdir/teeanymore. The full install'searly_data_dir_guardstill refuses a network data dir before this runs, unchanged. (The temp template uses trailingX's — BSDmktempon macOS rejects a suffix afterXXXXXX.)Acceptance
Tests
_choose_log_file: returns a path under a writableHOST_DATA_DIR; falls back to a temp path (never a bare failure) when the dir is uncreatable/unwritable.shellcheck --severity=error+ check-style + check-drift clean;scripts/manifest.sha256regenerated (R8).Closes#432
Note
Low Risk
Small, defensive change to installer logging path selection with unit tests; no change to full-install guard ordering or cluster/data semantics.
Overview
setup_log_fileno longer assumesHOST_DATA_DIRis creatable. A new_choose_log_filehelper triesmkdir -pplus a write probe underHOST_DATA_DIR; if that fails, it usesmktempwith a BSD-safeXXXXXXsuffix (no.logafter the X’s), or/dev/nullas last resort.setup_log_fileonly setsLOG_FILEfrom that helper and thentees as before.This closes the prepare-host gap left after #441: that path calls
setup_log_filebefore any network-FS guard, so NFS home +sudo+root_squashused to die with a cryptic mkdir/tee error (or mis-owned logs) instead of continuing to user-facing errors. The full install’searly_data_dir_guardordering is unchanged.Bats cover writable vs uncreatable
HOST_DATA_DIR;scripts/manifest.sha256is updated forcommon.sh.Reviewed by Cursor Bugbot for commit 0ca5bf2. Bugbot is set up for automated code reviews on this repo. Configure here.