bazelbuild / bazel

a fast, scalable, multi-language and extensible build system
https://bazel.build
Apache License 2.0
22.56k stars 3.95k forks source link

bazel-complete.bash doesnt do tab completion on bash 4.4.20(1)-release #22402

Open shantanu-gontia opened 2 weeks ago

shantanu-gontia commented 2 weeks ago

Description of the bug:

The Bazel completion plugin for Bash downloaded with bazel doesn't work for me. I'm using Bash 4.4.20(1)-release I'm not sure if this fails to run on newer versions, I haven't tested this yet.

I'm not too familiar with bash scripting, so I don't know if this is invalid syntax or perhaps some error in parsing the file with the bash version I'm on.

Which category does this issue belong to?

CLI

What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

Which operating system are you running Bazel on?

Linux

What is the output of bazel info release?

release 6.4.0

If bazel info release returns development version or (@non-git), tell us how you built Bazel.

No response

What's the output of git remote get-url origin; git rev-parse HEAD ?

No response

Is this a regression? If yes, please try to identify the Bazel commit where the bug was introduced.

No response

Have you found anything relevant by searching the web?

No response

Any other information, logs, or outputs that you want to share?

After some fiddling, what worked for me was removing the comments after every condition in the case...easc blocks

For instance, removing the comments of the form https://github.com/bazelbuild/bazel/blob/bb79b3ce9bed67359110fba67de8fe97f26c9e3c/scripts/bazel-complete-template.bash#L756 i.e. comments following one of the case matches in the same line.

fmeum commented 2 weeks ago

As this is tricky to reproduce, would you be interested in submitting a PR with the fixes required to get it to work on your machine?