Skip to content

bug: make array-kind validation case-sensitive under nocasematch #524

Description

@codeforester

Goal

Make array-kind validation independent of the caller's nocasematch shell option.

Background

PR #521 (fix: validate caller-owned output attributes) added caller-owned output
contracts and a regression test that enables shopt -s nocasematch. The hosted
validation run for that PR fails on both Ubuntu and macOS in the same test:

array output contracts distinguish indexed from associative arrays with nocasematch

The validator currently classifies the kind marker with a [[ ... == ... ]]
comparison. With nocasematch enabled, the lower-case indexed marker a matches
the upper-case associative marker A, so the validator emits the wrong diagnostic
instead of the indexed-array kind diagnostic. The existing string-split regression
test also asserts the later output-attribute diagnostic for an associative array;
that expectation needs to be corrected because the kind contract is the first
applicable contract and must reject the wrong array kind before checking writability.

Scope and acceptance criteria

  • Make the array-kind classification case-sensitive even when nocasematch is
    enabled by the caller.
  • Preserve the existing Bash 4.2-compatible implementation style and the public
    single-file library boundary.
  • Add a focused regression test that exercises the validator under nocasematch
    and verifies the indexed/associative distinction; update the string-split
    regression assertion to expect the correct indexed-array diagnostic.
  • Keep existing diagnostics, return codes, and caller-owned output preservation
    unchanged outside this defect.
  • bats focused regression tests pass, and ./tests/validate.sh passes.

Validation

The implementation PR will record the exact focused BATS command and full
validation result.

Non-goals

  • No redesign of the output-contract API.
  • No compatibility shim for pre-v2 behavior.
  • No unrelated refactoring or release/version changes.

Related: #521

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething is not working

Type

No type

Projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions