Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 767871 - app-admin/pass-otp-1.2.0-r1: wrong location for bash completion file pass-otp
Summary: app-admin/pass-otp-1.2.0-r1: wrong location for bash completion file pass-otp
Status: UNCONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Haelwenn (lanodan) Monnier
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-01-29 16:21 UTC by Alexander Graf
Modified: 2024-05-16 08:51 UTC (History)
4 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Fixed ebuild for app-admin/pass-otp-1.2.0 (pass-otp-1.2.0-r1.ebuild,631 bytes, text/plain)
2023-09-07 08:55 UTC, Tobias Leupold
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Graf 2021-01-29 16:21:28 UTC
Hi.

The ebuild installs /usr/share/bash-completion/completions/pass-otp
This file is not a stand-alone bash-completer but adds functions to the existing pass completer.
It needs to be installed to /etc/bash_completion.d/pass-otp in order to function correctly.

This can be fixed by removing BASHCOMPDIR="$(get_bashcompdir)" from the emake call or by replacing it with BASHCOMPDIR="/etc/bash_completion.d" - which is the upstream default.

Alex
Comment 1 Lars Wendler (Polynomial-C) (RETIRED) gentoo-dev 2021-01-29 16:31:24 UTC
/usr/share/bash-completion/completions is the default install location for packages. Istead of moving the file to some location whereit is not supposed to be installed by portage, the completion file should be fixed to work independently from its location.
Comment 2 Alexander Graf 2021-01-29 17:02:46 UTC
Hi Lars,

sorry, I thought /etc/bash_completion.d is valid location, as app-shells/gentoo-bashcomp installs its gentoo-style-init there too.

pass-otp is not a bash-completion script but only a function definition to be used by the bash-completion script.

I don't think bash-completion can handle multiple completers for a single command (here: "pass").

Feel free to close this.

Alex
Comment 3 Tobias Leupold 2023-09-07 08:49:41 UTC
I ran into this exact problem.

I have an Artix machine also running pass-otp. It installs the very same bash completion file (as also to be found upstream), and it puts it in /etc/bash_completion.d/. On Artix, it works out of the box, in contrast to the ebuild's approach.

As pass-otp is a pass plugin and the completion is also only an extension to the existing pass completion definition, I think this one can't live on it's own by defintion, as it's not a complete completion file -- the "otp" part is only a new "pass" parameter, so I don't think it would be even possible to have a stand-alone completion definition, is it?!

The fact that bash completion itself sources /etc/bash_completion.d/ and "pass otp" completion works as soon as the upstream file is put there leaves the impression to me that, in fact, /etc/bash_completion.d/ _is_ a standard place to put this very "plugin" type of definitions.

Would be nice if this was fixed. IMO this is not an upstream issue, but a Gentoo downstream one.
Comment 4 Tobias Leupold 2023-09-07 08:55:18 UTC
Created attachment 870013 [details]
Fixed ebuild for app-admin/pass-otp-1.2.0
Comment 5 Tobias Leupold 2023-12-20 13:30:16 UTC
Looks like the original maintainer of this ebuild (marked as "retired") won't (or can't) fix this.

Is anybody else willing to push the fix? It's quite trivial, and my tweaked ebuild fixes a broken major feature. Would be nice if the fixed ebuild would make it into portage.
Comment 6 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-12-20 13:51:26 UTC
The maintainer is not the person who wrangled the bug (who is now retired).

The standard location for _system_ completions is /usr/share. The user can put their own in /etc.

That said, I have no idea how the fact that it's a plugin/extension and that it can't work independently factors in here. It might then be tolerable for it to be in /etc. mgorny?
Comment 7 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2023-12-20 14:14:03 UTC
As a short term solution, I suppose compatdir is fine.

For a long term solution, I think it'd be best if pass completion actually supported looking for other completion files to load.  Right now it seems that they will be preloaded for it.  Perhaps it could either use a dedicated directory for its own completions.

CC-ing zx2c4.
Comment 8 Agostino Sarubbo gentoo-dev 2024-04-06 20:16:42 UTC
gcc14_tinderbox has reproduced this issue with version 1.2.0-r1 - Updating summary.
Comment 9 APN-Pucky 2024-05-16 08:51:41 UTC
I'm having the same issue. Only after I source pass-otp's completion it works. Maybe the title of the issue should be pass-otp completion not working?. The linked issue has an interesting comment that pass' completion itself should run

    _completion_loader "pass-$command"

similar to git. Can this maybe be patched into app-admin/pass?