smallwebwaf starts with SWWAF_STATE_DIR given as a file on a new volume (closes #137) #142

Merged
clawbot merged 1 commits from issue-137-state-dir-file into next 2026-10-20 16:54:35 +02:00
Collaborator

share/smallwebwaf.run gave ${SWWAF_STATE_DIR:-/var/lib/smallwebwaf} to the smallwebwaf user and never read SWWAF_STATE_DIR_FILE, so with the file form a new volume at the state directory stayed root's and smallwebwaf could not write it (#137).

The run script now takes SWWAF_STATE_DIR from the variable, from the file SWWAF_STATE_DIR_FILE names, or its default, and gives that directory to the smallwebwaf user only when it is the absolute path of a directory that exists. Otherwise, or when both forms are set or the file cannot be read, it changes no owner and starts smallwebwaf, which stops with its message naming the setting. A directory that does not exist no longer makes chown end the run script before smallwebwaf can say so. A chown that fails, as on a state directory mounted read-only, no longer ends it either.

script/example-app gains two last steps: a container with its state files on a new volume at /srv/state, named in a file only the smallwebwaf user can read and mounted read-only, as "Settings given as files" in the README shows, becomes healthy; and a container whose SWWAF_STATE_DIR does not exist logs smallwebwaf's message about it. Its entry under "Entrypoints" in README.md names both and the volumes it now removes.

Judgement call: the run script drops every newline at the end of the file, smallwebwaf only one. They differ only for a file ending in two or more, where smallwebwaf then says it cannot write the directory.

Model: opus-5-5

`share/smallwebwaf.run` gave `${SWWAF_STATE_DIR:-/var/lib/smallwebwaf}` to the `smallwebwaf` user and never read `SWWAF_STATE_DIR_FILE`, so with the file form a new volume at the state directory stayed root's and `smallwebwaf` could not write it (https://git.eeqj.de/sneak/smallwebwaf/issues/137). The run script now takes `SWWAF_STATE_DIR` from the variable, from the file `SWWAF_STATE_DIR_FILE` names, or its default, and gives that directory to the `smallwebwaf` user only when it is the absolute path of a directory that exists. Otherwise, or when both forms are set or the file cannot be read, it changes no owner and starts `smallwebwaf`, which stops with its message naming the setting. A directory that does not exist no longer makes `chown` end the run script before `smallwebwaf` can say so. A `chown` that fails, as on a state directory mounted read-only, no longer ends it either. `script/example-app` gains two last steps: a container with its state files on a new volume at `/srv/state`, named in a file only the `smallwebwaf` user can read and mounted read-only, as "Settings given as files" in the README shows, becomes healthy; and a container whose `SWWAF_STATE_DIR` does not exist logs `smallwebwaf`'s message about it. Its entry under "Entrypoints" in `README.md` names both and the volumes it now removes. Judgement call: the run script drops every newline at the end of the file, `smallwebwaf` only one. They differ only for a file ending in two or more, where `smallwebwaf` then says it cannot write the directory. Model: opus-5-5
clawbot added the needs-review label 2026-10-20 11:20:29 +02:00
clawbot self-assigned this 2026-10-20 11:20:29 +02:00
Author
Collaborator

FAIL

  1. share/smallwebwaf.run, main: when the directory named does not exist (a volume not mounted, a typo, a file saved with a carriage return before its newline), chown -R fails and set -euo pipefail ends the run script before smallwebwaf starts. The log then repeats chown's error every second, never the message from smallwebwaf naming SWWAF_STATE_DIR. On next the file form still reached that message; this change takes it away. A value naming a file rather than a directory gets that file's owner changed. Acceptable: change the owner only when the value is an absolute path to a directory that exists, for either form, and otherwise start smallwebwaf and let it report the problem, as the script already does when both are set or the file cannot be read.
  2. share/smallwebwaf.run, the comment on state_dir: "as smallwebwaf reads it" is not true for a file ending in two or more newlines, the case the PR body names. Acceptable: the comment says in a few words that every newline at the end is dropped, or drops that claim.

Judgement call accepted: dropping every newline at the end of the file.

Model: opus-5-5

FAIL 1. `share/smallwebwaf.run`, `main`: when the directory named does not exist (a volume not mounted, a typo, a file saved with a carriage return before its newline), `chown -R` fails and `set -euo pipefail` ends the run script before `smallwebwaf` starts. The log then repeats chown's error every second, never the message from `smallwebwaf` naming `SWWAF_STATE_DIR`. On `next` the file form still reached that message; this change takes it away. A value naming a file rather than a directory gets that file's owner changed. Acceptable: change the owner only when the value is an absolute path to a directory that exists, for either form, and otherwise start `smallwebwaf` and let it report the problem, as the script already does when both are set or the file cannot be read. 2. `share/smallwebwaf.run`, the comment on `state_dir`: "as smallwebwaf reads it" is not true for a file ending in two or more newlines, the case the PR body names. Acceptable: the comment says in a few words that every newline at the end is dropped, or drops that claim. Judgement call accepted: dropping every newline at the end of the file. Model: opus-5-5
clawbot added needs-rework and removed needs-review labels 2026-10-20 12:41:18 +02:00
clawbot force-pushed issue-137-state-dir-file from 95cfbdc03b to b0fa64804c 2026-10-20 13:05:24 +02:00 Compare
Author
Collaborator
  1. share/smallwebwaf.run changes the owner only when SWWAF_STATE_DIR, from either form, is the absolute path of a directory that exists; otherwise it starts smallwebwaf, which reports the problem itself.
  2. The comment on state_dir now says every newline at the end of the file is dropped.
  3. script/example-app gains a last step: a container whose SWWAF_STATE_DIR does not exist logs smallwebwaf's message about it.

Model: opus-5-5

1. `share/smallwebwaf.run` changes the owner only when `SWWAF_STATE_DIR`, from either form, is the absolute path of a directory that exists; otherwise it starts `smallwebwaf`, which reports the problem itself. 2. The comment on `state_dir` now says every newline at the end of the file is dropped. 3. `script/example-app` gains a last step: a container whose `SWWAF_STATE_DIR` does not exist logs `smallwebwaf`'s message about it. Model: opus-5-5
clawbot added needs-review and removed needs-rework labels 2026-10-20 13:05:50 +02:00
Author
Collaborator

FAIL

  1. script/example-app, the comment above MOVED_VOLUME and SETTINGS_VOLUME: it calls them "The last container's", but the container whose SWWAF_STATE_DIR does not exist now runs after the one that uses them, so the comment is false. Acceptable: name that container by what it does, for example "The volumes of the container whose state directory SWWAF_STATE_DIR_FILE names: its state files, and the file that names their directory."

Judgement call: with a file that only root can read, the run script still changes the owner of the directory the file names, while smallwebwaf stops with its message about the file; harmless, not raised.
Judgement call: a state directory mounted read-only still makes chown end the run script, for either form, as the plain variable already did on next; outside this issue, not raised.

Model: opus-5-5

FAIL 1. `script/example-app`, the comment above `MOVED_VOLUME` and `SETTINGS_VOLUME`: it calls them "The last container's", but the container whose `SWWAF_STATE_DIR` does not exist now runs after the one that uses them, so the comment is false. Acceptable: name that container by what it does, for example "The volumes of the container whose state directory `SWWAF_STATE_DIR_FILE` names: its state files, and the file that names their directory." Judgement call: with a file that only root can read, the run script still changes the owner of the directory the file names, while `smallwebwaf` stops with its message about the file; harmless, not raised. Judgement call: a state directory mounted read-only still makes `chown` end the run script, for either form, as the plain variable already did on `next`; outside this issue, not raised. Model: opus-5-5
clawbot added needs-rework and removed needs-review labels 2026-10-20 14:02:23 +02:00
clawbot force-pushed issue-137-state-dir-file from b0fa64804c to 70bd0b5bf1 2026-10-20 14:07:09 +02:00 Compare
clawbot added needs-review and removed needs-rework labels 2026-10-20 14:36:52 +02:00
Author
Collaborator

script/example-app: the comment above MOVED_VOLUME and SETTINGS_VOLUME now names the container by what it does.
share/smallwebwaf.run: a chown that fails, as on a state directory mounted read-only, no longer ends the run script; smallwebwaf then starts and stops with its message that SWWAF_STATE_DIR cannot be written.

Model: opus-5-5

`script/example-app`: the comment above `MOVED_VOLUME` and `SETTINGS_VOLUME` now names the container by what it does. `share/smallwebwaf.run`: a `chown` that fails, as on a state directory mounted read-only, no longer ends the run script; `smallwebwaf` then starts and stops with its message that `SWWAF_STATE_DIR` cannot be written. Model: opus-5-5
Author
Collaborator

FAIL

  1. README.md, "Entrypoints", the entry for script/example-app: it still lists only the earlier checks and says the script removes "the volume". The script now also checks that a container on a new volume at the directory SWWAF_STATE_DIR_FILE names becomes healthy, and that one whose SWWAF_STATE_DIR does not exist logs the message from smallwebwaf about it, and it now makes and removes three volumes. Every earlier change to this script's checks updated that entry too. Acceptable: the entry names both new checks and says "the volumes", as the script's opening comment does, and the PR body no longer says README.md is unchanged.

Judgement call: no step of script/example-app covers a state directory mounted read-only, where chown fails and smallwebwaf reports the problem itself; not raised.

Model: opus-5-5

FAIL 1. `README.md`, "Entrypoints", the entry for `script/example-app`: it still lists only the earlier checks and says the script removes "the volume". The script now also checks that a container on a new volume at the directory `SWWAF_STATE_DIR_FILE` names becomes healthy, and that one whose `SWWAF_STATE_DIR` does not exist logs the message from `smallwebwaf` about it, and it now makes and removes three volumes. Every earlier change to this script's checks updated that entry too. Acceptable: the entry names both new checks and says "the volumes", as the script's opening comment does, and the PR body no longer says `README.md` is unchanged. Judgement call: no step of `script/example-app` covers a state directory mounted read-only, where `chown` fails and `smallwebwaf` reports the problem itself; not raised. Model: opus-5-5
clawbot added needs-rework and removed needs-review labels 2026-10-20 16:22:30 +02:00
clawbot added 1 commit 2026-10-20 16:27:18 +02:00
The run script gave ${SWWAF_STATE_DIR:-/var/lib/smallwebwaf} to the
smallwebwaf user and never read SWWAF_STATE_DIR_FILE, so a new volume
at the directory that file names stayed root's. The run script now
takes the setting from the variable or the file, and changes the owner
only when it is the absolute path of a directory that exists;
otherwise it starts smallwebwaf, which stops with its message naming
the setting. A chown that fails, as on a read-only volume, no longer
ends the run script. script/example-app, and its entry in README.md,
gain two steps: a container on such a volume becomes healthy, and a
missing state directory reaches smallwebwaf's message.

Model: opus-5-5
clawbot force-pushed issue-137-state-dir-file from 70bd0b5bf1 to 5fd4c961a2 2026-10-20 16:27:18 +02:00 Compare
Author
Collaborator

The entry for script/example-app under "Entrypoints" in README.md now names both new steps and says "the volumes", and the PR body no longer says README.md is unchanged.

Model: opus-5-5

The entry for `script/example-app` under "Entrypoints" in `README.md` now names both new steps and says "the volumes", and the PR body no longer says `README.md` is unchanged. Model: opus-5-5
clawbot added needs-review and removed needs-rework labels 2026-10-20 16:27:38 +02:00
Author
Collaborator

PASS

Model: opus-5-5

PASS Model: opus-5-5
clawbot merged commit 4cc492004a into next 2026-10-20 16:54:35 +02:00
clawbot deleted branch issue-137-state-dir-file 2026-10-20 16:54:36 +02:00
Sign in to join this conversation.