Hi, thanks for the report.  I have a few comments, see below...

On Tue, Mar 05 2019, Boruch Baum wrote:
> 
> Performing an 'apt-get purge bash-completion' does not delete the folder
> /usr/share/bash-completion.

That's intentional.  Many packages install completion files under
/usr/share/bash-completion/completions, for instance, on my machine,
after purging bash-completion, I get:

  # dpkg -S /usr/share/bash-completion/completions/*
  adb: /usr/share/bash-completion/completions/adb
  util-linux: /usr/share/bash-completion/completions/addpart
  apt: /usr/share/bash-completion/completions/apt
  apt-file: /usr/share/bash-completion/completions/apt-file
  util-linux: /usr/share/bash-completion/completions/blkdiscard
  util-linux: /usr/share/bash-completion/completions/blkid
  util-linux: /usr/share/bash-completion/completions/blkzone
  util-linux: /usr/share/bash-completion/completions/blockdev
  systemd: /usr/share/bash-completion/completions/bootctl
  btrfs-progs: /usr/share/bash-completion/completions/btrfs
  devscripts: /usr/share/bash-completion/completions/bts
  devscripts: /usr/share/bash-completion/completions/build-rdeps
  ...
  (the list goes on and on)

Thus, 'apt-get purge bash-completion' cannot remove
/usr/share/bash-completion.

> Over time, that folder has accumulated what is now cruft, because when
> that package updates, it does not remove functions deleted in new
> releases;

Are you saying that apt-get update bash-completion will not remove files
that were present in version X, but removed in version X+1?  If that's
what you meant, then I need an example of such behavior, because, in my
experience, it does remove them.

> recently upstream has renamed one of their internal helper
> functions from 'have' to '_have', and since the cruft files still exist
> and are being processed, this results in errors because the old function
> name is no longer being found.

Maybe these files are installed by different packages, not
bash-completion

> An example of this is /usr/share/bash-completion/apt-show-versions,
> which at some point was removed from package bash-completion; however,
> since the debian packaging has never deleted it, it is now failing that
> way.

Maybe the output of

  $ dpkg -S /usr/share/bash-completion/completions/apt-show-versions

will tell us where this file comes from.

> A second example is /usr/share/bash-completion/insserv.

Likewise.
 
> There are also other files in that folder that are no longer in
> upstream, but are not producing that error, such as the script for bzr.

Likewise.

Actually, I have already checked this one:

  # dpkg -S /usr/share/bash-completion/completions/bzr
  bzr: /usr/share/bash-completion/completions/bzr

Which means that bash-completion has no power over this file.
 
> The package expects user-defined or third-party bash-completion scripts
> to be located in /etc/bash-completion.d, so there should never be a need
> for any non-upstream files in folder /usr/share/bash-completion/completions.

That's not true nowadays.  I believe that there was a time when all
completion files used to be installed under /etc/bash-completion.d, but
that is not the case anymore.  All completion files should be installed
under /usr/share/bash-completion/completions, even if they are shipped
by other packages, such as bzr.

Notice that bash-completion still looks for completion files under
/etc/bash-completion.d, but that is deprecated and only provided so that
other packages have time to migrate their files.
 
> As 'extra-credit', it would be nice if there were an apt hook for this
> package that when upstream was removing a script for a command, to
> mention that to the user, and prompt to move it to
> /etc/bash_completion.d or somewhere else. Another idea would be to just
> send apt mail to user with the file along with a message.

What are you referring to as upstream?  Upstream bash-completion?

Reply via email to