You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
B1-2: Fix systemd template unit — correct ExecStart and ExecStop invocations #135
Two things beyond what the issue asked for, both found while writing the gate.
RequiresMountsFor=/mnt/objectfs/%i is removed. It orders the unit after the mount units for the directory's parents, but /mnt/objectfs/%i is the mount this unit creates — so the line asks systemd to wait for the thing that is about to be started. The ExecStartPre that creates the directory is what actually has to happen first.
TimeoutStopSec is now stated rather than inherited, because it is the flush window. SIGTERM makes the mount process unmount, which writes buffered ranges to S3, and its exit code reports whether that completed. A short value there is a SIGKILL through buffered data, and inheriting systemd's default leaves it changeable by a drop-in with no sign in this file.
Two gates, and neither alone would have caught the old unit.
TestSystemdUnit* in internal/config parses the unit's Exec* lines through the same parseInvocation the documentation gate uses, and checks every subcommand and flag against the sets scraped from cmd/objectfs/main.go. So a flag renamed in the binary breaks the unit's test, and no list is maintained by hand. It also asserts ExecStop does not call a FUSE helper directly and does not pass -z/-l/-f — adding one of those to make a stubborn stop succeed is a plausible edit that would detach the mount with writes in flight. This runs everywhere go test does, including macOS.
A systemd-unit CI job runs systemd-analyze verify /etc/systemd/system/[email protected] for the half a Go test cannot check — instantiated, because %i has no value in the template and the uninstantiated form would be checked with unexpanded specifiers in ExecStart, ExecStop, and ReadWritePaths.
The split matters: systemd-analyze passes the old unit — ExecStart=/usr/local/bin/objectfs s3://%i /mnt/objectfs/%i and ExecStop=/bin/fusermount3 -u are both perfectly valid systemd — and a Go test cannot tell whether RequiresMountsFor means what its author thought.
Verified by mutation, six ways: ExecStop back to fusermount3 -u, the legacy bare form in ExecStart, --mount-point misspelled, --foreground misspelled, a typo'd ExecStartPre subcommand, and -z + Restart=always + no TimeoutStopSec together. The third of those initially did not fail, which found a real defect in the gate: the unit wraps ExecStart with a trailing backslash, and a loop over raw lines stops there and skips every flag after it. Joining continuations first is load-bearing, and that is now recorded in the test.
OBJECTFS.md also carried a copyable unit, with ExecStart=/usr/local/bin/objectfs %i /mnt/objectfs/%i — the bare instance name where a storage URI belongs, so it has no scheme and could never have mounted anything. It now points at the shipped unit, which is the one under gate.
Activity
scttfrdmn commentedon Aug 3, 2026
Landed in
e8750ebonv0.11.0-cli-subcommands, in the same commit as #134 since the unit depends on the subcommands.configs/systemd/[email protected]now runs:Two things beyond what the issue asked for, both found while writing the gate.
RequiresMountsFor=/mnt/objectfs/%iis removed. It orders the unit after the mount units for the directory's parents, but/mnt/objectfs/%iis the mount this unit creates — so the line asks systemd to wait for the thing that is about to be started. TheExecStartPrethat creates the directory is what actually has to happen first.TimeoutStopSecis now stated rather than inherited, because it is the flush window. SIGTERM makes the mount process unmount, which writes buffered ranges to S3, and its exit code reports whether that completed. A short value there is a SIGKILL through buffered data, and inheriting systemd's default leaves it changeable by a drop-in with no sign in this file.Two gates, and neither alone would have caught the old unit.
TestSystemdUnit*ininternal/configparses the unit'sExec*lines through the sameparseInvocationthe documentation gate uses, and checks every subcommand and flag against the sets scraped fromcmd/objectfs/main.go. So a flag renamed in the binary breaks the unit's test, and no list is maintained by hand. It also assertsExecStopdoes not call a FUSE helper directly and does not pass-z/-l/-f— adding one of those to make a stubborn stop succeed is a plausible edit that would detach the mount with writes in flight. This runs everywherego testdoes, including macOS.A
systemd-unitCI job runssystemd-analyze verify /etc/systemd/system/[email protected]for the half a Go test cannot check — instantiated, because%ihas no value in the template and the uninstantiated form would be checked with unexpanded specifiers inExecStart,ExecStop, andReadWritePaths.The split matters:
systemd-analyzepasses the old unit —ExecStart=/usr/local/bin/objectfs s3://%i /mnt/objectfs/%iandExecStop=/bin/fusermount3 -uare both perfectly valid systemd — and a Go test cannot tell whetherRequiresMountsFormeans what its author thought.Verified by mutation, six ways:
ExecStopback tofusermount3 -u, the legacy bare form inExecStart,--mount-pointmisspelled,--foregroundmisspelled, a typo'dExecStartPresubcommand, and-z+Restart=always+ noTimeoutStopSectogether. The third of those initially did not fail, which found a real defect in the gate: the unit wrapsExecStartwith a trailing backslash, and a loop over raw lines stops there and skips every flag after it. Joining continuations first is load-bearing, and that is now recorded in the test.OBJECTFS.mdalso carried a copyable unit, withExecStart=/usr/local/bin/objectfs %i /mnt/objectfs/%i— the bare instance name where a storage URI belongs, so it has no scheme and could never have mounted anything. It now points at the shipped unit, which is the one under gate.v0.11.0: subcommands, a security gate, and prices that know their region