fix: randomize run_rc marker to avoid output collision #19

Closed
opened 2026-05-25 17:27:28 +02:00 by michael · 1 comment
Owner

Goal

Reduce collision risk for the exit-code marker in sys:run_rc().

Current state

The marker __DAW_RC__: is a fixed string. If a command happens to
output this exact string, the exit code parsing breaks silently.

Proposed fix

Generate a random suffix per call so the marker is unique at runtime:

local marker = "__DAW_RC_" .. tostring(math.random(100000, 999999)) .. "__:"

Full stdout and stderr separation via tmpfile was considered but
rejected -- filesystem overhead per call is not justified here.

See also

## Goal Reduce collision risk for the exit-code marker in `sys:run_rc()`. ## Current state The marker `__DAW_RC__:` is a fixed string. If a command happens to output this exact string, the exit code parsing breaks silently. ## Proposed fix Generate a random suffix per call so the marker is unique at runtime: ```lua local marker = "__DAW_RC_" .. tostring(math.random(100000, 999999)) .. "__:" ``` Full stdout and stderr separation via tmpfile was considered but rejected -- filesystem overhead per call is not justified here. ## See also - DAW/daw-lua-common#18
Author
Owner

Marker is now DAW_RC<random 6-digit>_: per call, matching the fix proposed in the issue. Verified run_rc still parses exit codes correctly for both success and non-zero exit under 5.1 and 5.4.

Marker is now __DAW_RC_<random 6-digit>__: per call, matching the fix proposed in the issue. Verified run_rc still parses exit codes correctly for both success and non-zero exit under 5.1 and 5.4.
michael 2026-07-19 17:55:46 +02:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
DAW/daw-lua-common#19
No description provided.