Skip to content

bash-completion: Fix garbled output - #125328

Open
iBug wants to merge 2 commits into
ClickHouse:masterfrom
iBug:fix-bash-completion
Open

iBug wants to merge 2 commits into
ClickHouse:masterfrom
iBug:fix-bash-completion

Conversation

@iBug

@iBug iBug commented Oct 12, 2026 •

Copy link
Copy Markdown

Without this patch, when hitting Tab, this spits out to the terminal:

awk: cmd. line:1: (FILENAME=- FNR=2552) warning: Invalid multibyte data detected. There may be a mismatch between your data and your locale
-A: command not found
-C: command not found
-Cluster: command not found
-E: command not found
-H: command not found
-V: command not found
-b: command not found

This is due to multiple reasons:

  • ClickHouse generates invalid UTF-8 sequence in some cases
  • LANG=c alone insufficient for awk, it may be overridden by LC_ALL
  • Examples in help text being split and interpreted as options

This commit adds LC_ALL for awk, and change the option check to a stricter glob than merely "anything beginning with a dash and longer than 1".

Changelog category (leave one):

Bug Fix (user-visible misbehavior in an official stable release)

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

Fix bash-completion generating `awk` error messages and spurious "command not found" lines

Workflow [PR]
Sync PR [sync-upstream/pr/125328]

Without this patch, when hitting Tab, this spits out to the terminal:

awk: cmd. line:1: (FILENAME=- FNR=2552) warning: Invalid multibyte data detected. There may be a mismatch between your data and your locale
-A: command not found
-C: command not found
-Cluster: command not found
-E: command not found
-H: command not found
-V: command not found
-b: command not found

This is due to multiple reasons:

- ClickHouse generates invalid UTF-8 sequence in some cases
- `LANG=c` alone insufficient for `awk`, it may be overridden by `LC_ALL`
- Examples in help text being split and interpreted as options

This commit adds `LC_ALL` for `awk`, and change the option check to a
stricter glob than merely "anything beginning with a dash and longer
than 1".
@CLAassistant

CLAassistant commented Oct 12, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@clickhouse-gh clickhouse-gh Bot added comp-cli clickhouse-client (interactive CLI) and client library. external Author is not a member of the ClickHouse organization labels Oct 12, 2026
@george-larionov george-larionov added the can be tested Allows running workflows for external contributors label Oct 13, 2026
@clickhouse-gh

clickhouse-gh Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [ab772cc]

Summary: ❌

job_name test_name status info comment
Finish Workflow FAIL
python3 ./ci/jobs/scripts/workflow_hooks/new_tests_check.py FAIL
Build (amd_release) ERROR
Stateless tests (arm_asan_ubsan, targeted) ERROR
Integration tests (amd_asan_ubsan, db disk, targeted) ERROR
Stateless tests (amd_asan_ubsan, db disk, distributed plan, targeted) ERROR
Build profile diff ERROR
Build (amd_darwin) DROPPED
Build (arm_darwin) DROPPED
Build (arm_v80compat) DROPPED
Build (amd_freebsd) DROPPED

AI Review

Summary

This PR pins both Bash-completion awk pipelines to the C locale and filters extracted options before compgen expands them. The prior inline finding is fixed in the current head, ab772cc3b97c2e6777f2ef60723bcbeb5a5f29e3. Focused checks passed with GNU awk and mawk, including malformed UTF-8, help examples containing backticks, and both completion entrypoints. Approve with one changelog formatting nit.

PR Metadata

The Bug Fix category fits this change and requires a changelog entry. The entry describes the affected behavior, but should be a plain paragraph. Suggested replacement:

Fix Bash completion emitting awk warnings and spurious command not found messages.

Findings

💡 Nits

  • PR description: Remove the outer code fence from the changelog entry. generate_description in ci/tools/changelog.py joins its nonempty lines, retaining the fence markers in the published changelog instead of producing a normal paragraph.
Final Verdict

✅ Approve. No unresolved code findings; the changelog formatting correction is nonblocking.

@clickhouse-gh clickhouse-gh Bot added the pr-bugfix Pull request with bugfix, not backported by default label Oct 13, 2026
alexey-milovidov pushed a commit to tripleaceme/ClickHouse that referenced this pull request Oct 19, 2026
…ter walk

`_list_commits_page` ran one `gh api repos/ClickHouse/ClickHouse/commits`
call and raised on the first non-zero exit or timeout, and the per-TU
master first-parent walk makes ~20 such calls per job. GitHub fails single
requests (HTTP 503 and 504, a body cut short so `--jq` reports `unexpected
end of JSON input`, a stalled body) while the requests around them succeed,
so one blip errored the whole check: 9 jobs on 9 PRs between 2026-10-03 and
2026-10-14, the failing anchors 11-15 days deep in walks whose earlier
fetches had just succeeded, and the same commits passing on other runs.

Retry the listing up to 3 times (after 5 s, then 10 s), keeping the 120 s
per-call timeout. A timeout, an HTTP 5xx or 429, or a failure whose stderr
names no HTTP status is retried; any other 4xx (unknown sha, permissions)
fails at once, since `gh` reports an HTTP error as `gh: <message> (HTTP
<status>)`. After the last attempt the error propagates as before, so the
walk stays fail-close as the `extend_master_shas` docstring requires. The
praktika `GH` helpers retry but pass no subprocess timeout, which ClickHouse#115201
kept on this call site on purpose.

CI reports:
- https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=124959&sha=1d61eebf3fe5ed809d4811ea947169074a3e1712&name_0=PR&name_1=Build%20profile%20diff
  (ClickHouse#124959)
- https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=125328&sha=ab772cc3b97c2e6777f2ef60723bcbeb5a5f29e3&name_0=PR&name_1=Build%20profile%20diff
  (ClickHouse#125328)
- https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=122585&sha=bf8b2d2470663e1b5703c2014b7887fe2d5dd239&name_0=PR&name_1=Build%20profile%20diff
  (ClickHouse#122585)
- https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=119371&sha=88edddd16dcd4250ac56e1642f964a03763097f4&name_0=PR&name_1=Build%20profile%20diff
  (ClickHouse#119371)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@clickhouse-gh clickhouse-gh Bot added comp-build-system Build system (CMake, compilation, platform builds). and removed comp-cli clickhouse-client (interactive CLI) and client library. labels Nov 19, 2026

This branch has not been deployed

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

Labels

can be tested Allows running workflows for external contributors comp-build-system Build system (CMake, compilation, platform builds). external Author is not a member of the ClickHouse organization pr-bugfix Pull request with bugfix, not backported by default

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants