Skip to content

fix(installer): stop resurrecting files FOG has dropped from management/other - #1346

Merged
mastacontrola merged 1 commit into
working-1.6from
fix-web-other-restore-scope
Aug 24, 2026
Merged

fix(installer): stop resurrecting files FOG has dropped from management/other#1346
mastacontrola merged 1 commit into
working-1.6from
fix-web-other-restore-scope

Conversation

@mastacontrola

Copy link
Copy Markdown
Member

Follow-up to #1344. _variables.scss was still on the live tree after an installfog.sh run, and this is why.

What was happening

configureHttpd() does rm -rf $webdirdest and rebuilds from source, so an upgrade genuinely gets the new release — then it restores loose files from the pre-wipe backup of management/other/, which is where an administrator's own files live (ca.cert.pem, a logo, whatever they put there).

Deciding "ours or theirs" was done from a hardcoded list:

find .../management/other/ -maxdepth 1 -type f \
  -not -name gpl-3.0.txt -a -not -name index.php -a -not -name 'ca.*'

That list is a second, hand-kept description of what the release ships, and it drifted the first time FOG dropped a file it had been shipping there. _variables.scss — the Font Awesome 4 icon list #1344 deleted — was not on it, so every install classified it as the administrator's and copied it back out of the backup. It could never leave an upgraded server, on any install, ever.

Three kinds of FOG-owned file, three different answers

The first attempt at this got it wrong, and the test is what said so.

  1. What this release ships. Asked of the source tree now, so it cannot drift from what is actually shipped.
  2. What FOG shipped there in the past and dropped. The source tree cannot see these — a file the release no longer ships is indistinguishable from one the administrator put there. So retirement is recorded in retired_web_other, which is append-only: add a name there in the same commit that removes the file from packages/web.
  3. ca.* — not shipped in the tree at all, but minted into that directory by _installCATrustAnchor(). Restoring the previous one over a freshly generated CA hands the server a stale trust anchor: the certificate fog-client pins and iPXE is built against. Kept named, because there is nothing to derive it from.

The source-tree test alone does not fix the reported symptom. With only that change, _variables.scss is still absent from the source tree and still restored. Only (2) closes it — that is why the retired list exists rather than being one more thing to remember.

Pinned

tests/webroot-preserved-files.test.sh executes the loop against a fixture rather than reading it — a textual check passes on a loop that names the right variables and gets the logic backwards, and the logic is the whole change. It also pins that the decision is not made from a hand-kept list of shipped files again, and that the ca.* exclusion survives being tidied away as redundant.

Mutation-verified, four mutants, all killed:

Mutant Result
drop the retired list the dropped file is resurrected
drop the source-tree test a shipped file is overwritten from the backup
drop the ca.* exclusion the stale CA is restored over the new one
invert the source-tree test shipped files overwritten and the administrator's own file lost

Suite: 146 passed, 0 failed. No root, no network, no FOG install needed to run it.

🤖 Generated with Claude Code

https://claude.ai/code/session_01XqpPXAk7bEm8huH9WkiGk6

…nt/other

configureHttpd() does `rm -rf $webdirdest` and rebuilds from source, then
restores loose files from the pre-wipe backup of management/other/ -- the
directory an administrator's own files live in. Deciding "ours or theirs" was
done from a hardcoded list, `gpl-3.0.txt` and `index.php`.

That list is a second, hand-kept description of what the release ships, and it
drifted the first time FOG dropped a file it had been shipping there.
management/other/_variables.scss -- the Font Awesome 4 icon list the picker
used to read, dead since the FA7 migration -- was not on it, so every install
classified it as the administrator's and copied it back. It could never leave
an upgraded server, on any install, ever.

FOG owns three kinds of file in that directory and they need three different
answers, which is what the first attempt at this got wrong:

  1. What this release ships. Asked of the source tree now, so it cannot drift
     from what is actually shipped.
  2. What FOG shipped there in the PAST and dropped. The source tree CANNOT
     see these -- a file the release no longer ships is indistinguishable from
     one the administrator put there -- so retirement is recorded in
     retired_web_other, which is append-only. Add a name there in the same
     commit that removes the file from packages/web.
  3. ca.*, not shipped at all but minted into the directory by
     _installCATrustAnchor(). Restoring the previous one over a freshly
     generated CA hands the server a stale trust anchor -- the certificate
     fog-client pins and iPXE is built against. Kept named, because there is
     nothing to derive it from.

The source-tree test alone does NOT fix the reported symptom, and the test
below is what said so: with only that change, _variables.scss is still absent
from the source tree and still restored. Only (2) closes it.

tests/webroot-preserved-files.test.sh EXECUTES the loop against a fixture
rather than reading it -- a textual check passes on a loop that names the
right variables and gets the logic backwards, and the logic is the whole
change. It also pins that the decision is not made from a hand-kept list of
shipped files again, and that the ca.* exclusion survives being tidied away as
redundant.

Mutation-verified, four mutants, all killed:

  - drop the retired list          -> the dropped file is resurrected
  - drop the source-tree test      -> a shipped file is overwritten
  - drop the ca.* exclusion        -> the stale CA is restored
  - invert the source-tree test    -> shipped files overwritten and the
                                      administrator's own file lost

Suite: 146 passed, 0 failed.

Co-Authored-By: Claude <noreply@anthropic.com>
@mastacontrola
mastacontrola merged commit 8fe2abf into working-1.6 Aug 24, 2026
7 checks passed
@mastacontrola
mastacontrola deleted the fix-web-other-restore-scope branch August 24, 2026 12:47
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.

1 participant