bash completion not working: uses deprecated have()

Bug #1775043 reported by Paulo Marcel Coelho Aragão on 2018-06-04
20
This bug affects 3 people
Affects Status Importance Assigned to Milestone
ufw
Medium
Jamie Strandboge
ufw (Ubuntu)
Status tracked in Disco
Bionic
Medium
Jamie Strandboge
Cosmic
Medium
Jamie Strandboge
Disco
Medium
Jamie Strandboge

Bug Description

[Impact]

Tab completion is currently broken.

[Test Case]

$ ufw <tab><tab>
allow delete --dry-run --help logging reset status
app deny enable insert reject route version
default disable --force limit reload show

With an unpatched ufw, tab completion only shows the files in the current directory, which is meaningless for ufw.

[Regression Potential]

Risk of regression is considered very low since tab completion is totally broken and correct functionality is easily tested.

= Original description =

bash completion, defined in /usr/share/bash-completion/completions/ufw, doesn't work: the completion is not dynamically loaded, because it uses deprecated helper function have().

According to /usr/share/bash-completions/bash_completion, which defines the helper functions:

# Backwards compatibility for compat completions that use have().
# @deprecated should no longer be used; generally not needed with dynamically
# loaded completions, and _have is suitable for runtime use.

and at the end of the file:

unset -f have
unset have

which means: function have() is not available for usage. The bash completion for ufw conditionally defines _ufw and the comspec:

have ufw &&
_ufw()
...

[ "$have" ] && complete -F _ufw ufw

These should be changed to:

_have ufw &&
_ufw()
...

_have ufw && complete -F _ufw ufw

ProblemType: Bug
DistroRelease: Ubuntu 18.04
Package: ufw 0.35-5
ProcVersionSignature: Ubuntu 4.15.0-22.24-generic 4.15.17
Uname: Linux 4.15.0-22-generic x86_64
ApportVersion: 2.20.9-0ubuntu7.1
Architecture: amd64
CurrentDesktop: XFCE
Date: Mon Jun 4 14:34:11 2018
InstallationDate: Installed on 2018-04-28 (37 days ago)
InstallationMedia: Xubuntu 18.04 LTS "Bionic Beaver" - Release amd64 (20180426)
PackageArchitecture: all
SourcePackage: ufw
UpgradeStatus: No upgrade log present (probably fresh install)

Jamie Strandboge (jdstrand) wrote :

Thank you for reporting this. I'll get it fixed in upstream ufw, Debian and Ubuntu 18.10. I'll then do an SRU for 18.04 LTS.

Changed in ufw:
assignee: nobody → Jamie Strandboge (jdstrand)
status: New → In Progress
Changed in ufw (Ubuntu Bionic):
status: New → Triaged
Changed in ufw (Ubuntu Cosmic):
status: New → Triaged
Changed in ufw (Ubuntu Bionic):
assignee: nobody → Jamie Strandboge (jdstrand)
Changed in ufw (Ubuntu Cosmic):
assignee: nobody → Jamie Strandboge (jdstrand)
Jamie Strandboge (jdstrand) wrote :

This was committed to ufw a while ago and will be in the upcoming 0.36, which I plan to SRU back to bionic.

Changed in ufw:
status: In Progress → Fix Committed
Changed in ufw:
importance: Undecided → Medium
Changed in ufw (Ubuntu Disco):
status: Triaged → In Progress
importance: Undecided → Medium
Changed in ufw (Ubuntu Cosmic):
importance: Undecided → Medium
Changed in ufw (Ubuntu Bionic):
importance: Undecided → Medium
Jamie Strandboge (jdstrand) wrote :

This is fixed in the new 0.36 release.

Changed in ufw:
status: Fix Committed → Fix Released
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package ufw - 0.36-1

---------------
ufw (0.36-1) unstable; urgency=medium

  * New upstream release (LP: #1782384, LP: #1664133, LP: #1509725,
    LP: #1695718, LP: #1719211, LP: #1775043, LP: #1204579, LP: #1652163,
    LP: #1377600, Closes: 686248, LP: #1368411, LP: #1586258, Closes: 909163,
    Closes: 884932, LP: #1558068)
    - drop 0002-bug849628.patch (included upstream)
    - drop 0003-use-default-tcp-syncookies.patch (included upstream)
    - drop 0004-lp1633698.patch (included upstream)
  * Remaining changes:
    - 0001-optimize-boot.patch
  * debian/ufw.maintscript: remove /etc/bash_completion.d/ufw on upgrade
    (LP: #1602834)
  * debian/control: remove no longer needed xs-python-version and
    x-python3-version fields
  * update debian/before6.rules.md5sum for file shipped in 0.35-6. While both
    before.rules and before6.rules were updated in this new upstream release,
    0.35-6 mistakenly already had its own md5sum for before.rules, so we don't
    need to add it now.

 -- Jamie Strandboge <email address hidden> Fri, 14 Dec 2018 17:50:47 +0000

Changed in ufw (Ubuntu Disco):
status: In Progress → Fix Released
description: updated
Changed in ufw (Ubuntu Bionic):
status: Triaged → In Progress
Changed in ufw (Ubuntu Cosmic):
status: Triaged → In Progress
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers