all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [bug#57345] [PATCH] Add gnupg to propagated-inputs of trezor-agent
@ 2022-08-22 19:03 guix-patches--- via
  2022-09-01  8:51 ` Ricardo Wurmus
                   ` (3 more replies)
  0 siblings, 4 replies; 13+ messages in thread
From: guix-patches--- via @ 2022-08-22 19:03 UTC (permalink / raw)
  To: 57345

[-- Attachment #1: Type: text/plain, Size: 246 bytes --]

This is my first patch submission ever.
Please tell me if there is anything I did wrong.

The patch is motivated by failure of `trezor-gpg init` command.
After I applied it to the system, I was able to initialize my Trezor-based GPG identity.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Add-gnupg-to-propagated-inputs-of-trezor-agent.patch --]
[-- Type: text/x-patch; name=0001-Add-gnupg-to-propagated-inputs-of-trezor-agent.patch, Size: 911 bytes --]

From 8c8d465c28923591a5ef7124b1f6835a6f398c51 Mon Sep 17 00:00:00 2001
From: Marek Paśnikowski <marekpasnikowski@protonmail.com>
Date: Mon, 22 Aug 2022 20:10:47 +0200
Subject: [PATCH] Add gnupg to propagated-inputs of trezor-agent

This fixes "OSError: Cannot find 'gpgconf' in $PATH".
---
 gnu/packages/finance.scm | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/gnu/packages/finance.scm b/gnu/packages/finance.scm
index 849f9aba99..f6c15aebdb 100644
--- a/gnu/packages/finance.scm
+++ b/gnu/packages/finance.scm
@@ -1223,6 +1223,8 @@ (define-public trezor-agent
      (list python-trezor python-trezor-agent))
     (native-inputs
      (list python-attrs))
+    (propagated-inputs
+     (list gnupg))
     (home-page "https://github.com/romanz/trezor-agent")
     (synopsis "Using Trezor as hardware SSH/GPG agent")
     (description "This package allows using Trezor as a hardware SSH/GPG
-- 
2.37.2


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [bug#57345] [PATCH] Add gnupg to propagated-inputs of trezor-agent
  2022-08-22 19:03 [bug#57345] [PATCH] Add gnupg to propagated-inputs of trezor-agent guix-patches--- via
@ 2022-09-01  8:51 ` Ricardo Wurmus
  2022-09-05  5:49 ` guix-patches--- via
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 13+ messages in thread
From: Ricardo Wurmus @ 2022-09-01  8:51 UTC (permalink / raw)
  To: 57345

Hi Marek,

thanks for your patch.  This looks like a good fix of the problem.

Propagation is generally used sparingly, when there is no other option.
We try to avoid it when possible, because it can lead to unexpected
conflicts, e.g. when a user has a particular version of gnupg installed
in their profile and then installs trezor-agent with a more recent
version of Guix it would abort with a conflict error as it cannot
install two variants of gnupg into the same Guix profile.

I wonder if we can avoid propagation here.  We could, for example, look
up gnupg in PATH (so that a user’s installation of gnupg is preferred)
and fall back to an explicit gnupg from the inputs (not
propagated-inputs).  This would require minor patching of trezor-agent.

What do you think?

-- 
Ricardo




^ permalink raw reply	[flat|nested] 13+ messages in thread

* [bug#57345] [PATCH] Add gnupg to propagated-inputs of trezor-agent
  2022-08-22 19:03 [bug#57345] [PATCH] Add gnupg to propagated-inputs of trezor-agent guix-patches--- via
  2022-09-01  8:51 ` Ricardo Wurmus
@ 2022-09-05  5:49 ` guix-patches--- via
  2022-09-05  9:25   ` Efraim Flashner
  2022-09-06 15:48   ` Maxime Devos
  2022-10-11 14:44 ` [bug#57345] (No Subject) Attila Lendvai
  2024-09-09 14:33 ` [bug#57345] Status: [PATCH] Add gnupg to propagated-inputs of trezor-agent Attila Lendvai
  3 siblings, 2 replies; 13+ messages in thread
From: guix-patches--- via @ 2022-09-05  5:49 UTC (permalink / raw)
  To: 57345@debbugs.gnu.org

Nothing I do seems to work at all.

Last night I thought of a fundamental question:
Are `inputs` accessible in the guix store at runtime?

If they are, that means I am too dumb to correctly parse the documentation. My initial patch proves, that `gnupg` has to be available at runtime. At this point I am incapable of doing anything more. I got physically sick of trying to understand and use all the procedures.




^ permalink raw reply	[flat|nested] 13+ messages in thread

* [bug#57345] [PATCH] Add gnupg to propagated-inputs of trezor-agent
  2022-09-05  5:49 ` guix-patches--- via
@ 2022-09-05  9:25   ` Efraim Flashner
  2022-09-05 11:26     ` guix-patches--- via
  2022-09-06 15:48   ` Maxime Devos
  1 sibling, 1 reply; 13+ messages in thread
From: Efraim Flashner @ 2022-09-05  9:25 UTC (permalink / raw)
  To: Marek Paśnikowski; +Cc: Ricardo Wurmus, 57345@debbugs.gnu.org

[-- Attachment #1: Type: text/plain, Size: 2736 bytes --]

On Mon, Sep 05, 2022 at 05:49:55AM +0000, guix-patches--- via wrote:
> Nothing I do seems to work at all.
> 
> Last night I thought of a fundamental question:
> Are `inputs` accessible in the guix store at runtime?
> 
> If they are, that means I am too dumb to correctly parse the documentation. My initial patch proves, that `gnupg` has to be available at runtime. At this point I am incapable of doing anything more. I got physically sick of trying to understand and use all the procedures.

After some poking around on IRC and in trezor-agent and
python-trezor-agent, it seems that there are a number of calls to the
gpgconf binary and the actual path to gpg is probably set in
python-trezor-agent in libagent/gpg/keyring.py. With all of this it's
probably best to just wrap the files in the bin output of trezor agent
so that we don't miss any files.

(ins)efraim@3900XT /tmp$ tree /gnu/store/46br8illcfv93ryh28s2haz1s59n584v-trezor-agent-0.14.4
/gnu/store/46br8illcfv93ryh28s2haz1s59n584v-trezor-agent-0.14.4
├── bin
│   ├── __pycache__
│   │   └── trezor_agent.cpython-39.pyc
│   ├── trezor-agent
│   ├── trezor_agent.py
│   ├── trezor-gpg
│   ├── trezor-gpg-agent
│   └── trezor-signify
└── lib
    └── python3.9
        └── site-packages
            └── trezor_agent-0.11.0-py3.9.egg-info
                ├── dependency_links.txt
                ├── entry_points.txt
                ├── PKG-INFO
                ├── requires.txt
                ├── SOURCES.txt
                └── top_level.txt

trezor_agent.py is an actual python script, so I'd use wrap-script, but
the other extensionless files I'd use wrap-program, which IIRC will Do
The Right Thing™ and not double-wrap those files, which are already
wrappers.

I haven't tested the code out, but something like this should work
inside trezor-agent.

(add-before 'check 'wrap-more
  ;; We want to make sure we're before 'check but after 'wrap
  (lambda* (#:key inputs outputs #:allow-other-keys)
    (wrap-script (string-append #$output "/bin/trezor_agent.py")
      `(("PATH" ":" prefix (,(dirname (search-input-file inputs
      "gpg"))))))
    (for-each
      (lambda (file)
        (wrap-program file
          `(("PATH" ":" prefix (,(dirname (search-input-file inputs
          "gpg")))))))
      (find-files (string-append #$output "/bin") "^trezor-"))))

-- 
Efraim Flashner   <efraim@flashner.co.il>   אפרים פלשנר
GPG key = A28B F40C 3E55 1372 662D  14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [bug#57345] [PATCH] Add gnupg to propagated-inputs of trezor-agent
  2022-09-05  9:25   ` Efraim Flashner
@ 2022-09-05 11:26     ` guix-patches--- via
  2022-09-06 13:06       ` guix-patches--- via
                         ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: guix-patches--- via @ 2022-09-05 11:26 UTC (permalink / raw)
  To: Efraim Flashner; +Cc: Ricardo Wurmus, 57345@debbugs.gnu.org

I have encountered the same problem as in this email:
https://lists.gnu.org/archive/html/help-guix/2019-06/msg00073.html

I do not understand how to apply the proposed fix.




^ permalink raw reply	[flat|nested] 13+ messages in thread

* [bug#57345] [PATCH] Add gnupg to propagated-inputs of trezor-agent
  2022-09-05 11:26     ` guix-patches--- via
@ 2022-09-06 13:06       ` guix-patches--- via
  2022-09-06 15:41         ` Maxime Devos
  2022-09-06 15:39       ` Maxime Devos
  2022-09-06 15:44       ` Maxime Devos
  2 siblings, 1 reply; 13+ messages in thread
From: guix-patches--- via @ 2022-09-06 13:06 UTC (permalink / raw)
  To: Efraim Flashner; +Cc: Ricardo Wurmus, 57345@debbugs.gnu.org

Let us not have perfect be the enemy of good, and merge the `propagated-inputs` solution. Once an `inputs` solution is found, it would be used instead.

A potential conflict with other `gnupg` instances is less harmful than the currently happening guaranteed loss of major functionality.

What do you think?




^ permalink raw reply	[flat|nested] 13+ messages in thread

* [bug#57345] [PATCH] Add gnupg to propagated-inputs of trezor-agent
  2022-09-05 11:26     ` guix-patches--- via
  2022-09-06 13:06       ` guix-patches--- via
@ 2022-09-06 15:39       ` Maxime Devos
  2022-09-06 15:44       ` Maxime Devos
  2 siblings, 0 replies; 13+ messages in thread
From: Maxime Devos @ 2022-09-06 15:39 UTC (permalink / raw)
  To: Marek Paśnikowski, Efraim Flashner
  Cc: Ricardo Wurmus, 57345@debbugs.gnu.org


[-- Attachment #1.1.1: Type: text/plain, Size: 218 bytes --]


On 05-09-2022 13:26, guix-patches--- via wrote:
> I do not understand how to apply the proposed fix.

Copy-paste Efraim's phase to the %standard-phases (I assume before 
fixup-agent-py).

Greetings,
Maxime


[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 929 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 236 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [bug#57345] [PATCH] Add gnupg to propagated-inputs of trezor-agent
  2022-09-06 13:06       ` guix-patches--- via
@ 2022-09-06 15:41         ` Maxime Devos
  0 siblings, 0 replies; 13+ messages in thread
From: Maxime Devos @ 2022-09-06 15:41 UTC (permalink / raw)
  To: Marek Paśnikowski, Efraim Flashner
  Cc: Ricardo Wurmus, 57345@debbugs.gnu.org


[-- Attachment #1.1.1: Type: text/plain, Size: 449 bytes --]


On 06-09-2022 15:06, guix-patches--- via wrote:
> Let us not have perfect be the enemy of good, and merge the `propagated-inputs` solution. Once an `inputs` solution is found, it would be used instead.
>
> A potential conflict with other `gnupg` instances is less harmful than the currently happening guaranteed loss of major functionality.
>
> What do you think?

Efraim has posted a potential 'inputs' solution.

Greetings,
Maxime.


[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 929 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 236 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [bug#57345] [PATCH] Add gnupg to propagated-inputs of trezor-agent
  2022-09-05 11:26     ` guix-patches--- via
  2022-09-06 13:06       ` guix-patches--- via
  2022-09-06 15:39       ` Maxime Devos
@ 2022-09-06 15:44       ` Maxime Devos
  2 siblings, 0 replies; 13+ messages in thread
From: Maxime Devos @ 2022-09-06 15:44 UTC (permalink / raw)
  To: Marek Paśnikowski, Efraim Flashner
  Cc: Ricardo Wurmus, 57345@debbugs.gnu.org


[-- Attachment #1.1.1: Type: text/plain, Size: 476 bytes --]


On 05-09-2022 13:26, guix-patches--- via wrote:
> I have encountered the same problem as in this email:
> https://lists.gnu.org/archive/html/help-guix/2019-06/msg00073.html
>
> I do not understand how to apply the proposed fix.
>
IIRC, python-build-system uses G-exps nowadays, so to use #$, all you 
need to do is replace

(arguments `(#:phases (modify-phases ...)))

by

(arguments (list #:phases #~(modify-phases ...))),

no need for separate inputs.



[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 929 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 236 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [bug#57345] [PATCH] Add gnupg to propagated-inputs of trezor-agent
  2022-09-05  5:49 ` guix-patches--- via
  2022-09-05  9:25   ` Efraim Flashner
@ 2022-09-06 15:48   ` Maxime Devos
  2022-09-09 19:55     ` guix-patches--- via
  1 sibling, 1 reply; 13+ messages in thread
From: Maxime Devos @ 2022-09-06 15:48 UTC (permalink / raw)
  To: Marek Paśnikowski, 57345@debbugs.gnu.org


[-- Attachment #1.1.1: Type: text/plain, Size: 906 bytes --]


On 05-09-2022 07:49, guix-patches--- via wrote:
> Nothing I do seems to work at all.
>
> Last night I thought of a fundamental question:
> Are `inputs` accessible in the guix store at runtime?
If a reference (i.e., a /gnu/store/the-input-... string) ends up in the 
resulting store item of trezor-agent, then yes.
> If they are, that means I am too dumb to correctly parse the documentation.
As far as I'm aware it is not documented that the GC is based on 
reference-scanning.
> My initial patch proves, that `gnupg` has to be available at runtime. At this point I am incapable of doing anything more. I got physically sick of trying to understand and use all the procedures.

Look where 'gnupg' is used in trezor-agent (git grep -F can be useful) 
and replace it with substitute* + search-input-file. Alternatively, 
wrap-program, as proposed in Efraim's reply.

Greetings,
Maxime.


[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 929 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 236 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [bug#57345] [PATCH] Add gnupg to propagated-inputs of trezor-agent
  2022-09-06 15:48   ` Maxime Devos
@ 2022-09-09 19:55     ` guix-patches--- via
  0 siblings, 0 replies; 13+ messages in thread
From: guix-patches--- via @ 2022-09-09 19:55 UTC (permalink / raw)
  To: Maxime Devos; +Cc: 57345@debbugs.gnu.org

I give up.

So far, the cleanest workaround is to explicitly declare `gnupg` installation.
I decided to use that going forward.

```
(inputs (list gnupg guile-2.0 python-3 python-trezor python-trezor-agent))

(add-before 'check 'wrap-more
  (lambda* (#:key inputs outputs #:allow-other-keys)
    (wrap-script (string-append #$output "/bin/trezor_agent.py")
      '("PATH" ":" prefix '("/gnu/store/3bpq5knfvzhxhqfwzqm9br917nz7r0yp-gnupg-2.2.32/bin")))))
```

This is as far as I was able to go while maintaining any sense of understanding and control over the code.
All attempts to progress end with this failure:

```
Backtrace [...]

ERROR:
  1. &wrap-error:
      program: "/gnu/store/rb3wzd5pi899mlvv4wj35afc4z8ys60m-trezor-agent-0.14.4/bin/trezor_agent.py"
      type: no-interpreter-found
```

Clearly, the wrapping documentation assumes something and fails to mention it - and now a programming noob like me is totally lost.

My conclusions:
1. Current state of `trezor-agent` - broken critical functionality by default.
2. Presence of `gnupg` in profile fixes the above.
3. `propagated-inputs` also fixes 1., but is not acceptable.
4. In theory, it should be possible to expose a PATH to `gnupg` in `inputs`; but after days of working towards it, I am still not capable of reaching this solution.




^ permalink raw reply	[flat|nested] 13+ messages in thread

* [bug#57345] (No Subject)
  2022-08-22 19:03 [bug#57345] [PATCH] Add gnupg to propagated-inputs of trezor-agent guix-patches--- via
  2022-09-01  8:51 ` Ricardo Wurmus
  2022-09-05  5:49 ` guix-patches--- via
@ 2022-10-11 14:44 ` Attila Lendvai
  2024-09-09 14:33 ` [bug#57345] Status: [PATCH] Add gnupg to propagated-inputs of trezor-agent Attila Lendvai
  3 siblings, 0 replies; 13+ messages in thread
From: Attila Lendvai @ 2022-10-11 14:44 UTC (permalink / raw)
  To: 57345@debbugs.gnu.org

the problem is that there's no #! shebang line at the head of trezor_agent.py

but i'm not sure that file needs to be patched. the user-facing entry point is trezor-agent, not the .py file.

-- 
• attila lendvai
• PGP: 963F 5D5F 45C7 DFCD 0A39
--
“There is no reason ever to have the same thought twice, unless you like having that thought.”
	— David Allen (1945–), 'Getting Things Done'





^ permalink raw reply	[flat|nested] 13+ messages in thread

* [bug#57345] Status: [PATCH] Add gnupg to propagated-inputs of trezor-agent
  2022-08-22 19:03 [bug#57345] [PATCH] Add gnupg to propagated-inputs of trezor-agent guix-patches--- via
                   ` (2 preceding siblings ...)
  2022-10-11 14:44 ` [bug#57345] (No Subject) Attila Lendvai
@ 2024-09-09 14:33 ` Attila Lendvai
  3 siblings, 0 replies; 13+ messages in thread
From: Attila Lendvai @ 2024-09-09 14:33 UTC (permalink / raw)
  To: bug#57345

[-- Attachment #1: Type: text/plain, Size: 483 bytes --]


i have updated Trezor support in https://issues.guix.gnu.org/73148 and
the last patch fixes this issue (by using absolute store paths to access
gnupg binaries).

i think this one can be closed.

-- 
• attila lendvai
• PGP: 963F 5D5F 45C7 DFCD 0A39
--
“If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that, too.”
	— Somerset Maugham (1874–1965)

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 686 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2024-09-09 14:36 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-22 19:03 [bug#57345] [PATCH] Add gnupg to propagated-inputs of trezor-agent guix-patches--- via
2022-09-01  8:51 ` Ricardo Wurmus
2022-09-05  5:49 ` guix-patches--- via
2022-09-05  9:25   ` Efraim Flashner
2022-09-05 11:26     ` guix-patches--- via
2022-09-06 13:06       ` guix-patches--- via
2022-09-06 15:41         ` Maxime Devos
2022-09-06 15:39       ` Maxime Devos
2022-09-06 15:44       ` Maxime Devos
2022-09-06 15:48   ` Maxime Devos
2022-09-09 19:55     ` guix-patches--- via
2022-10-11 14:44 ` [bug#57345] (No Subject) Attila Lendvai
2024-09-09 14:33 ` [bug#57345] Status: [PATCH] Add gnupg to propagated-inputs of trezor-agent Attila Lendvai

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.