#182 Fix broken fedpkg bash-completion
Merged 6 years ago by cqi. Opened 6 years ago by tmz.

@@ -193,6 +193,7 @@ 

          request-branch)

              options="--no-git-branch --all-releases"

              options_string="--sl"

+             ;;

          request-repo)

              options="--exception"

              options_string="--description --monitor --upstreamurl --summary"

The completion code added in f7d9b56 ("Port fedrepo-req and
fedrepo-req-branch to fedpkg", 2017-12-07) missed ';;' separating the
request-branch and request-repo patterns. Attempting to source the
bash completion script results in an error:

$ . /usr/share/bash-completion/completions/fedpkg.bash
-bash: /usr/share/bash-completion/completions/fedpkg.bash: line 196: syntax error near unexpected token `)'
-bash: /usr/share/bash-completion/completions/fedpkg.bash: line 196: `        request-repo)'

This causes all completion to be unusable, so it would be very nice to fix it fairly quickly.

@tmz Thank you very much. There will be a release soon including some changes merged in the past several days. And apparently that will also include your fix. How about that?

@tmz Do you have any idea or suggestions how to test bash completion in a test? Just like the unit tests we write in the code base. That would be much convenient for us to catch potential problems easily to avoid testing it manually. Thank you.

Looks good to me. Merging.

Pull-Request has been merged by cqi

6 years ago

Thanks @cqi! :)

@tmz Thank you very much. There will be a release soon including some changes merged in the past several days. And apparently that will also include your fix. How about that?

Yeah, that sounds good. I figured if a release wasn't coming soon, this would be worth doing one, since it's an easy fix and the completion is broken without it. (Though maybe not as many people use the completion as I think.)

@tmz Do you have any idea or suggestions how to test bash completion in a test? Just like the unit tests we write in the code base. That would be much convenient for us to catch potential problems easily to avoid testing it manually. Thank you.

Hmm, a really basic test may be a syntax check, ensuring bash -n conf/bash-completion/fedpkg.bash >/dev/null 2>&1 has a non-zero status. Actually testing the output is more work, but it can be done.

The git project has some fairly extensive tests for its completion which may provide some inspiration.

I haven't looked in ages, but the bash-completion project includes tests as well, maybe they can be copied or leveraged?

@tmz Hi, there is a bug reported in Bugzilla for this problem as well. So, I just built new builds with your patch. Those new builds are in Bodhi now.

Metadata