Skip to content

fix: guard against missing value args for cc and speed settings#56

Draft
toddr-bot wants to merge 1 commit intomainfrom
koan.toddr.bot/fix-missing-value-warnings
Draft

fix: guard against missing value args for cc and speed settings#56
toddr-bot wants to merge 1 commit intomainfrom
koan.toddr.bot/fix-missing-value-warnings

Conversation

@toddr-bot
Copy link
Copy Markdown
Collaborator

@toddr-bot toddr-bot commented Apr 3, 2026

What

Guard _parse_char_value() and speed handlers against missing value arguments.

Why

Calling stty(\*FH, 'intr') without a value caused shift @parameters to return undef, which triggered a cascade of "Use of uninitialized value" warnings through the pattern matching chain in _parse_char_value(). Worse, it silently set the control character to 0 — which on Linux happens to be _POSIX_VDISABLE, effectively disabling the character without any clear indication of what went wrong. Same issue affected ispeed/ospeed without a rate argument.

How

  • _parse_char_value() now returns undef with a clear warning when passed an undefined value
  • All 11 cc handlers check the return before assignment (skip if undef)
  • ispeed/ospeed handlers validate the rate argument before lookup

Testing

  • 2 new tests in t/01-parse-char-value.t verify the undef input path
  • Full suite passes: 147 tests, 0 failures

🤖 Generated with Claude Code


Quality Report

Changes: 2 files changed, 36 insertions(+), 12 deletions(-)

Code scan: clean

Tests: passed (OK)

Branch hygiene: 1 issue(s)

  • Branch is not pushed to remote

Generated by Kōan post-mission quality pipeline

When a control character name (intr, quit, etc.) or speed setting
(ispeed, ospeed) was passed without a following value argument,
shift @parameters returned undef, causing a cascade of
"uninitialized value" warnings and silently setting the cc slot
to 0 (which disables the character on Linux).

Now _parse_char_value returns undef with a clear warning for
missing values, and the cc handlers skip assignment. Speed
handlers also validate before lookup.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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