Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 920771 - app-eselect/eselect-pinentry: add support for 3rd-party implementations
Summary: app-eselect/eselect-pinentry: add support for 3rd-party implementations
Status: UNCONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal enhancement (vote)
Assignee: No maintainer - Look at https://wiki.gentoo.org/wiki/Project:Proxy_Maintainers if you want to take care of it
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-12-27 08:53 UTC by Fat-Zer
Modified: 2024-01-10 23:36 UTC (History)
2 users (show)

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


Attachments
Propoused patch for pinentry.eselect (file_920771.txt,849 bytes, patch)
2024-01-09 21:19 UTC, Fat-Zer
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Fat-Zer 2023-12-27 08:53:36 UTC
There are some 3rd-party out-of-tree implementations for pinentry like app-crypt/pinentry-bemenu in guru. It would be nice to have those selectable by app-eselect/eselect-pinentry. It's obviously not expected to list all those implementation gentoo doesn't have control over, but it would be nice to provide  some control to the end-user.

The implementation may be as simple as this:

--- a/app-eselect/eselect-pinentry/files/pinentry.eselect-0.7.2
+++ b/app-eselect/eselect-pinentry/files/pinentry.eselect-0.7.2
@@ -6,7 +6,7 @@ MAINTAINER="maintainer-needed@gentoo.org"
 VERSION="0.7.2"

 SYMLINK_PATH=/usr/bin/pinentry
-SYMLINK_TARGETS=( pinentry-efl pinentry-gnome3 pinentry-qt5 pinentry-curses pinentry-tty )
+SYMLINK_TARGETS=( $(cd "${EROOT}/usr/bin/" && ls -d pinentry-* 2>/dev/null) )
 SYMLINK_DESCRIPTION='pinentry binary'

 inherit bin-symlink

Reproducible: Always
Comment 1 Andreas Sturmlechner gentoo-dev 2023-12-27 09:40:17 UTC
Some revdeps have USE-deps on app-crypt/pinentry, how is that going to be resolved?
Comment 2 Fat-Zer 2023-12-27 12:37:19 UTC
(In reply to Andreas Sturmlechner from comment #1)
> Some revdeps have USE-deps on app-crypt/pinentry, how is that going to be
> resolved?

It won't be. And it's not really needed too. Without any gui flags app-crypt/pinentry will just provide pinentry-tty as a fallback. Against which I believe even the most thorough purists won't object.

But that's beyond the scope of the bug. It's just about being able to select an another implementation via `eselect pinentry` without extra hassle...
Comment 3 Ulrich Müller gentoo-dev 2024-01-08 11:16:27 UTC
Why would you need this? "eselect pinentry set pinentry-bemenu" (e.g.) should work out of the box.


(In reply to Fat-Zer from comment #0)
> -SYMLINK_TARGETS=( pinentry-efl pinentry-gnome3 pinentry-qt5 pinentry-curses pinentry-tty )
> +SYMLINK_TARGETS=( $(cd "${EROOT}/usr/bin/" && ls -d pinentry-* 2>/dev/null) )

This is not allowed:

.. Warning:: In ebuilds, global scope code can cause problems.
  In eselect modules, global scope code is **absolutely forbidden**.
  Your module *will* be sourced for tasks other than running your
  actions. For example, if ``eselect modules list`` is executed, your
  module will be sourced to obtain the description. Any code being run
  here would be a very bad thing.

https://wiki.gentoo.org/wiki/Project:Eselect/Developer_guide#A_simple_module
Comment 4 Fat-Zer 2024-01-09 21:19:30 UTC
Created attachment 881794 [details, diff]
Propoused patch for pinentry.eselect
Comment 5 Fat-Zer 2024-01-09 22:00:37 UTC
(In reply to Ulrich Müller from comment #3)
> Why would you need this? "eselect pinentry set pinentry-bemenu" (e.g.)
> should work out of the box.

Raw "ln -sf pinentry-bemenu /usr/bin/pinentry" works too, there is for sure no strict necessity in that, but eselect is about some extra level of convenience, IMHO it'd be just a nice thing to have.

Though, I won't insist on it if it will be PIA to implement, so feel free to close the bug in such case.

> This is not allowed:
> 
> .. Warning:: In ebuilds, global scope code can cause problems.
>   In eselect modules, global scope code is **absolutely forbidden**.
>   Your module *will* be sourced for tasks other than running your
>   actions. For example, if ``eselect modules list`` is executed, your
>   module will be sourced to obtain the description. Any code being run
>   here would be a very bad thing.
> 
> https://wiki.gentoo.org/wiki/Project:Eselect/Developer_guide#A_simple_module

make sense... I've added another proposed patch (small enough, though a bit hacky).
Comment 6 Ulrich Müller gentoo-dev 2024-01-10 12:01:53 UTC
I'd say that find_targets() and TARGETS are internal and undocumented functions and variables of bin-symlink.bash, so the module shouldn't rely on them.

If you really want something like this, one way to go would be to add some wildcard mechanism to the library. CCing maintainer of app-eselect/eselect-lib-bin-symlink.

Alternatively, I see no harm in adding a couple of out-of-tree implementations to SYMLINK_TARGETS. In fact, this would be a less intrusive change.
Comment 7 Fat-Zer 2024-01-10 23:36:28 UTC
(In reply to Ulrich Müller from comment #6)
> I'd say that find_targets() and TARGETS are internal and undocumented
> functions and variables of bin-symlink.bash, so the module shouldn't rely on
> them.
> 
> If you really want something like this, one way to go would be to add some
> wildcard mechanism to the library. CCing maintainer of
> app-eselect/eselect-lib-bin-symlink.

`app-eselect/eselect-lib-bin-symlink` is a part of the eselect itself right now... So it'd be a slightly harder task for pushing of changes into... But if we are onto this, I'd be all-in for approach of "install some file to add an alternative" like installing a `/usr/share/eselect/alternatives/pinentry/bemenu`: `pinentry-bemenu` which could be installed by `app-crypt/pinentry-bemenu` in the example. But having pinentry as the only example that would benefit from the change it would be hard to push for it... 

I haven't thought before of "adding globbing to the `eselect/lib/bin-symlink`" approach, but it might be actually a nice compromise idea too...

On the other hand it might be possible to push towards documenting of utilising find_targets()/TARGETS in such way.

> Alternatively, I see no harm in adding a couple of out-of-tree
> implementations to SYMLINK_TARGETS. In fact, this would be a less intrusive
> change.

Cards on the table: I was pushing for this one while having in mind trinity (KDE3 fork) repository[1]. As for now it's not even a part of official `eselect repository` list, but it has an `app-crpt/pinentry-tqt` ebuild which is a continuation of a qt3 source code in the pinentry source base. As for now the overlay has its own app-eselect/eselect-pinentry version but it's already outdated and unmaintainable in the long-term, so I was hoping to drop it and introduce its support by the upstream version in some way.

I know that gentoo mainstream is not very inclined toward supporting of outside projects, so I believed the better approach would be to represent the issue in a more universal way, taking an example from an already a semi-official overlay.

[1]: https://mirror.git.trinitydesktop.org/gitea/TDE/tde-packaging-gentoo