Skip to content

fix: close the COMPAT.md bugs shared by the Python and Zig builds - #22

Merged
HaoZeke merged 6 commits into
mainfrom
fix/compat-bugs
Nov 17, 2026
Merged

HaoZeke merged 6 commits into
mainfrom
fix/compat-bugs

Conversation

@HaoZeke

@HaoZeke HaoZeke commented Nov 17, 2026

Copy link
Copy Markdown
Collaborator

Five bugs that COMPAT.md listed between the Python and Zig builds, or that both shared, are fixed. Each change is the same in both builds, and a regression test fails before the fix.

A --timeout or configured timeout above 2147483.647 seconds is refused with the same warning in both builds, which names that limit, and the earlier value is kept. The Python guard used to accept it and then skip every decision that ran a command with OverflowError: timeout is too large.

The Zig build started through PATH by a symbolic link reads the config beside the link (AT_EXECFN), as the Python guard does, not beside the link's target.

When the time limit passes and the cache directory does not open for the last cache read, both builds report that error, such as PermissionError, instead of a timeout.

Both builds refuse a --restore request whose env holds a value that is not a string, with restore request is malformed. The Python guard also refuses NaN, Infinity and -Infinity as not JSON, with exit 1, as the Zig build already did.

--chain and --timeout no longer take a next word that starts with - as their value. --chain --strict is a strict run. --chain -h prints help. --chain=PATH and --timeout=SEC take the rest of the word as it is.

COMPAT.md drops the five rows and the section of bugs both builds shared. The unreleased COMPAT.md fragment keeps only its sentence on the cache row.

The Python guard accepted a --timeout or configured timeout up to
threading.TIMEOUT_MAX, 9223372036 seconds, but subprocess waits for a
command with poll(), whose timeout is a C int of milliseconds. Above
2147483.647 seconds every decision that ran a command was skipped with
"OverflowError: timeout is too large", exit 0, or 78 with --strict;
just above that limit it depended on how long the decision had run
before its first wait. The Zig build took the same values and decided.

DESIGN.md has an out-of-range timeout keep the earlier value and warn,
so both builds now refuse a value above 2147483.647 that way instead of
clamping it: TIMEOUT_MAX is that number, and the warning names it. A
new test runs both builds at the limit, just above it and at the old
maximum, from the command line and from the configuration file.

COMPAT.md drops the row and the appendix entry that listed the bug,
and DESIGN.md and the pages that quote the warning give the new limit.
Started by name through PATH by a symbolic link in another directory
than its target, as eval "$(eessi-arch-guard --shell)" can be, the Zig
build read eessi-arch-guard.conf beside the link's target, which
/proc/self/exe names, because argv[0] then holds no slash. The Python
guard reads the one beside the link: __file__ is the path execve was
given, which the PATH search makes the link it found, and the
configuration page says the directory is that of the path the program
was started by, without following a symbolic link. Slurm starts a
TaskProlog by its absolute path, so only such --shell runs were
affected.

The Zig build now takes that same path from the kernel's AT_EXECFN,
falling back to argv[0] and /proc/self/exe without it, and makes it
absolute and normalizes it as Python's start-up and os.path.abspath do.
Started by a relative path, it used to name the config with the "." and
".." parts of that path left in; it now prints the path the Python
guard prints. A new test starts each build through a PATH entry that
holds a link to the program, given as an absolute and as a relative
directory, and expects the warning about the config beside the link.

COMPAT.md drops the row that listed the bug and says where the Zig
build gets the path, and the configuration page covers both builds.
When the time limit passed, the Zig build read the cache once more and,
if the cache directory did not open, took that as a miss and reported a
timeout. The Python guard opens the directory in _read_cache outside
any handler, so the OSError, such as a PermissionError once TMPDIR has
lost its permissions, reaches main, which prints the skip line with it
and leaves EESSI_ARCH_GUARD_FAILED alone.

The Zig build now stops there with error.Os and the text Python's str()
gives, the path shown as repr() shows it, and main names the OSError
subclass Python picks for the errno instead of always OSError. A new
test runs each build with a TMPDIR of mode 000 and a GPU query that
hangs past the limit, and expects the PermissionError skip line.

COMPAT.md drops the row that listed the bug, and lists the characters
past U+00FF that the Zig build keeps where repr() escapes them.
A --restore request whose env held a value that was not a string was
read differently by the two builds. The Python guard took str() of it,
so that null became "None" and a list its repr, and went on to run
Lmod; the Zig build did the same for null, true, false and numbers but
refused a list or an object as malformed. NaN and Infinity were read
by json.loads and refused by the Zig build's parser as not JSON.

The guard's own requests hold only strings, so both builds now refuse
any other env value with "restore request is malformed" before Lmod is
looked at, and the Python helper refuses NaN, Infinity and -Infinity
as not JSON, with exit 1, as the Zig build does. A new test sends each
build requests with each kind of value and expects these replies.

COMPAT.md drops the last unintended difference and its section, says
what a request may hold, and lists the 32-level nesting limit of the
Zig build's parser among the deliberate differences.
Both builds took the word after --chain or --timeout as its value,
whatever it was. With --chain --strict the chained path was "--strict",
refused with "--chain is not an absolute executable", and the run was
not strict: a failed decision exited 0. The rest of the program reads
--strict from the raw argv, so the restore and the cache still used the
strict workspace, the helper got --strict, and an error the decision's
handler did not catch still exited 78.

A word that starts with "-" is never a valid chain path or timeout, so
both builds now read it as an option of its own and leave the value
empty, as when there is no next word; the empty value gets the usual
warning. --chain=PATH and --timeout=SEC take the rest of the word as it
is. parse_args then agrees with the raw-argv checks for --strict and
--shell. New tests check the parsing in each build, and run both builds
with --chain --strict and with --timeout --strict while archdetect
fails, which now exits 78.

The CLI reference states the rule, and COMPAT.md describes it in the
argument rows and drops the section of bugs both builds shared.
The fragment said that COMPAT.md lists the differences between the
builds that are bugs, and named five. The commits before this one fix
all five and drop their rows. Both ship in the same release, so the
release notes would announce tables the release no longer has, beside
the Bugfixes entries that say each bug is fixed.

The fragment keeps only its sentence on the cache row, which still
holds, and names COMPAT.md in it, as the sentence now stands alone.
@HaoZeke
HaoZeke merged commit 54e7312 into main Nov 17, 2026
12 checks passed
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