If we have Fish installed and try to install pretty new softwares via APT package manager (on Ubuntu), we may encounter this error:
Error: error processing archive /var/cache/apt/archives/just_1.35.0-1build1_amd64.deb (--unpack):
Error: error processing archive /var/cache/apt/archives/just_1.35.0-1build1_amd64.deb (--unpack):
trying to overwrite '/usr/share/fish/completions/just.fish', which is also in package fish 4.0b1-1~oracular
trying to overwrite '/usr/share/fish/completions/just.fish', which is also in package fish 4.0b1-1~oracular
Errors were encountered while processing:
/var/cache/apt/archives/just_1.35.0-1build1_amd64.deb
The reason is that, Fish pre-included an auto-completion script for that software, and that software also come with its own Fish-based auto-completion script, trying to install to the same location as Fish one.
The quick solution is to tell package manager to move the second script to another place:
> sudo dpkg-divert --package just --divert /usr/share/fish/completions/just.fish.upstream --rename /usr/share/fish/completions/just.fish
The true solution is that, the new software needs to install its script to another place that Fish reserves for, /usr/share/fish/vendor_completions.d/.