Skip to content

Guard LSIO conf append for parity with non-LSIO - #385

Merged
ptr727 merged 1 commit into
developfrom
fix-lsio-conf-write-guard
May 25, 2026
Merged

ptr727 merged 1 commit into
developfrom
fix-lsio-conf-write-guard

Conversation

@ptr727

@ptr727 ptr727 commented May 25, 2026

Copy link
Copy Markdown
Owner

Summary

Round-4 follow-up from Copilot's review on PR #381. The LSIO init script (init-nx-relocate/run) appended to /config/etc/mediaserver.conf without checking the result. The script runs as root, but the underlying /config mount can be on a read-only filesystem or otherwise rejected, so a silent failure would leave mediaserver running without the OS variant override.

Fix

Apply the same defensive pattern non-LSIO already uses in Docker/entrypoint.sh (added in #384): wrap the append in an if, log a clear stderr warning on failure, and only chown on successful write. Both variants now log "Added" on success and "Warning: failed to write" on failure with a hint about what to check.

Test plan

  • dotnet test CreateMatrixTests/CreateMatrixTests.csproj — 16/16 pass.
  • CI matrix passes.

Copilot round-4 on PR #381 flagged that the LSIO init script appends
to /config/etc/mediaserver.conf without checking the result. The
script runs as root so writability normally is not an issue, but the
underlying /config mount can be on a read-only filesystem or
otherwise rejected — a silent fail would leave mediaserver running
without the OS variant override and the chown would also fail.

Apply the same defensive pattern Docker/entrypoint.sh uses: wrap the
append in an if and log a clear stderr warning on failure. Only chown
on successful write (no point chowning a file that wasn't appended
to).
Copilot AI review requested due to automatic review settings May 25, 2026 16:13

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Aligns the LSIO s6 init script with the non-LSIO entrypoint by guarding the append to mediaserver.conf with a conditional that logs a clear stderr warning on failure and only chowns after a successful write.

Changes:

  • Wrap the currentOsVariantOverride=docker append in an if to detect write failure.
  • Log "Added ..." on success and "Warning: failed to write ..." on failure.
  • Update the comment to document the defensive write pattern.

@ptr727
ptr727 merged commit def01d1 into develop May 25, 2026
40 checks passed
@ptr727
ptr727 deleted the fix-lsio-conf-write-guard branch May 25, 2026 16:50
ptr727 added a commit that referenced this pull request May 25, 2026
## Summary

Copilot flagged on PR #381 (round-5 & round-6) that the `chown` added by
#385 sits at the end of the success path in the LSIO init script.
Because `init-nx-relocate` is an s6-rc **oneshot** service, a non-zero
exit from its last command fails the service and breaks container init —
even though the actual conf write succeeded. Filesystems that don't
support ownership changes (SMB/NFS/Windows-backed) trigger this.

## Fix

Wrap the `chown` in an `if`-guard. On failure, log a clear stderr
warning ("filesystem may not support ownership changes — continuing")
and fall through; the outer `fi` always evaluates to 0, so the script
exits cleanly. The actual conf-write outcome still drives the
user-facing success/failure messaging.

## Test plan

- [x] `dotnet test CreateMatrixTests/CreateMatrixTests.csproj` — 16/16
pass.
- [ ] CI matrix passes.
- [ ] Manual: mount a `/config` volume backed by an exFAT or similar
non-chown filesystem, start the LSIO container, confirm the s6 oneshot
completes (container reaches running state, mediaserver launches) and
the warning appears in container logs.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants