Skip to content

fix(ci): shell-portability-lint's sort -V token misses operator-terminated forms #1537

Description

@kyle-sexton

Found during automated review of #1530, which fixed the same defect in that PR's own new --sort=WORD token but deliberately left this pre-existing sibling alone (widening it changes the gate's firing envelope over the existing corpus, not over #1530's new token).

Defect

scripts/shell-portability-tokens.txt ships:

sort[^\n]*[[:space:]]-[A-Za-z]*V[A-Za-z]*([[:space:]]|$)

The trailing boundary accepts only whitespace or end of line, so a sort -V whose flag is terminated by a shell control operator is a false negative:

  • x=$(sort -V)
  • sort -V|head -n1
  • sort -V; echo done

Each is the same GNU-only version-sort operation the token exists to reject, and each passes the gate today.

Fix shape

Mirror what #1530 landed for the long form — make the boundary every character that can actually END a shell word:

([[:space:]|&;()<>'"`]|$)

Same treatment likely applies to the sibling short-flag tokens with the same boundary (grep -P, echo -e), so audit all three together rather than one at a time.

Before landing

Run bash scripts/check-shell-portability.sh --all before and after and diff the hit set: the widened boundary may surface real corpus sites that were silently passing, and those need a fix or a recorded portability-ok: rather than being absorbed into the token edit.

Test plan

Activity

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

Metadata

Metadata

Assignees

Labels

agent-readyFully specified and briefed; eligible for autonomous pickup from the frontier.area: securitySecurity-relevant: vulnerability, hardening, or disclosure follow-up.priority: lowNice-to-have, cosmetic, or speculative; opportunistic.status: readyTriaged, unblocked, and fully specified; eligible to pick up.

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions