Skip to content

Use POSIX-compliant tail to extract token line in EKS command - #73690

Merged
shahar1 merged 1 commit into
apache:mainfrom
AlejandroMorgante:fix-eks-token-last-line-posix
Sep 27, 2026
Merged

shahar1 merged 1 commit into
apache:mainfrom
AlejandroMorgante:fix-eks-token-last-line-posix

Conversation

@AlejandroMorgante

@AlejandroMorgante AlejandroMorgante commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

The COMMAND template in EksHook used bash parameter expansion with $'\n' quoting to strip to the last line of the token helper output. $'...' is a bash extension — not POSIX — and silently breaks on some sh implementations used in container environments.

Replace it with printf '%s\n' "$output" | tail -n 1, which is POSIX-compliant and also tolerates extra lines on stdout when a dependency bypasses the stderr redirect.

Split out from #72542 per review request, so the fix to the existing operator lands independently of the new operator.

related: #72542


Was generative AI tooling used to co-author this PR?
  • Yes — Claude Code (Sonnet 4.6)

Generated-by: Claude Code (Sonnet 4.6) following the guidelines


The bash parameter expansion with $'\n' quoting used to strip to the
last line of the token helper output is a bash-specific extension not
guaranteed by POSIX; it silently breaks on sh implementations that do
not support it. Replace with `printf '%s\n' "$output" | tail -n 1`,
which is portable and also handles spurious stdout lines from
dependencies that bypass the stderr redirect.
@shahar1
shahar1 merged commit 3107af0 into apache:main Sep 27, 2026
83 checks passed
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.

3 participants