Skip to content

CFE-612: Made signal name matching case-insensitive#6199

Open
nickanderson wants to merge 3 commits into
cfengine:masterfrom
nickanderson:CFE-612/master
Open

CFE-612: Made signal name matching case-insensitive#6199
nickanderson wants to merge 3 commits into
cfengine:masterfrom
nickanderson:CFE-612/master

Conversation

@nickanderson

Copy link
Copy Markdown
Member

Signal names can now be written in any case (TERM, Term, term, etc.)
without triggering a validation error or failing to match.

Ticket: CFE-612
Changelog: Title

if (pid == 1)
{
if (RlistLen(a->signals) == 1 && RlistKeyIn(a->signals, "hup"))
if (RlistLen(a->signals) == 1 && RlistKeyIn_IgnoreCase(a->signals, "hup"))
if (pid == 1)
{
if (RlistLen(a->signals) == 1 && RlistKeyIn(a->signals, "hup"))
if (RlistLen(a->signals) == 1 && RlistKeyIn_IgnoreCase(a->signals, "hup"))
Signal names can now be written in any case (TERM, Term, term, etc.)
without triggering a validation error or failing to match.

Ticket: CFE-612
Changelog: Title
nickanderson and others added 2 commits June 27, 2026 16:24
The case-insensitive signals change wrapped the entire validation
alternation in (?i:...), which also made the sleep-period token
[0-9]+s? case-insensitive. As a result "10S" passed policy validation,
but the runtime sleep parser in verify_processes.c only accepts a
lowercase 's', so "10S" was treated as an unknown signal name
(SignalFromString returns -1) and reached kill(pid, -1).

Move [0-9]+s? outside the (?i:...) group so case-insensitivity applies
only to signal names, keeping validation aligned with the runtime.

Ticket: CFE-612
Changelog: None

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
signals_case_insensitive.cf relied on a fixed 2s sleep to wait for the
victim to install its SIGTERM trap and a fixed 3s sleep for the trap to
write its sentinel. Both margins can be too short on a loaded CI host
(false failure) and pure waste on a fast one.

Replace them with bounded polls: the victim writes a ready file after
installing its trap, and a small helper polls (up to ~10s) for a file to
become non-empty -- one for the ready file before signalling, one for the
sentinel before the check bundle reads it.

Ticket: CFE-612
Changelog: None

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants