Skip to content

fix(githooks): rename LINENO to avoid shadowing bash built-in#30587

Merged
siddseethepalli merged 1 commit into
mainfrom
swarm/9e1f/task-11
May 13, 2026
Merged

fix(githooks): rename LINENO to avoid shadowing bash built-in#30587
siddseethepalli merged 1 commit into
mainfrom
swarm/9e1f/task-11

Conversation

@siddseethepalli
Copy link
Copy Markdown
Contributor

@siddseethepalli siddseethepalli commented May 13, 2026

Summary

Follow-up to #30549. The variable LINENO in pre-commit hook shadows bash's built-in LINENO, which always evaluates to the current script line number regardless of assignment. So LINENO="${line%%:*}" had no lasting effect — when later referenced, bash returned the script's physical line (~877), not the grep match line.

Result: sed -n "$((LINENO + 1))p" fetched approximately line 878 of the staged file regardless of match position. For YAML files shorter than ~878 lines, NEXT_LINE was always empty, so the context guard always failed and bare clientSecret: was never whitelisted even in legitimate OpenAPI schemas.

Renamed to MATCH_LINENO and added an inline comment documenting why.

Test plan

  • .githooks/pre-commit --self-test passes

Open in Devin Review

Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 1 additional finding.

Open in Devin Review

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