(ledger|trezor|keepkey)-agent execute shell code with python interpreter

  • Done
  • quality assurance status badge
Details
2 participants
  • Danny Milosavljevic
  • Vagrant Cascadian
Owner
unassigned
Submitted by
Vagrant Cascadian
Severity
normal

Debbugs page

Vagrant Cascadian wrote 6 years ago
(address . bug-guix@gnu.org)
87mun76p1y.fsf@ponder
When running trezor-agent (or any of the others), I get a bizarre python
traceback with a bunch of code that looks to be shell code.

$ trezor-agent
Traceback (most recent call last):
File "/gnu/store/77i5pm165ljn8fx030z41yqaja77lb99-trezor-agent-0.10.0/bin/.trezor-agent-real", line 11, in <module>
load_entry_point('trezor-agent==0.10.0', 'console_scripts', 'trezor-agent')()
File "/gnu/store/9z98cvjm7p7z21xdid1ryydxy5vyz6wr-python-3.7.0/lib/python3.7/site-packages/pkg_resources/__init__.py", line 480, in load_entry_point
...
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "/gnu/store/77i5pm165ljn8fx030z41yqaja77lb99-trezor-agent-0.10.0/bin/trezor_agent.py", line 2
export PYTHONPATH="/gnu/store/ ... site-packages${PYTHONPATH:+:}$PYTHONPATH"
^
SyntaxError: invalid syntax

It looks to me that .trezor-agent-real is trying to import
trezor_agent.py as a python module, and obviously failing, because it
is also a shell wrapper around .trezor_agent.py-real

My guess is the correct way to fix this is to not install the shell
wrapper around trezor_agent.py and/or put trezor_agent.py into a
proper module in PYTHONPATH, rather than in /bin.

I'm not sure how to do that in the packaging, but I've manually hacked
around this by copying all of the .*-real files from /bin into another
directory, renaming them to their original names, adding the directory
to PATH, and setting PYTHONPATH manually to what the shell wrappers were
doing, and then I'm able to at least use the ssh-agent and gpg-agent
functionality...


Currently, none of these packages build in master because python-trezor
doesn't build anymore, but I've submitted a patch to update and fix
python-trezor(#34326), and have local patches dependent on that to
update python-trezor-agent, trezor-agent, ledger-agent and keepkey-agent
that at least get it to build.


live well,
vagrant
-----BEGIN PGP SIGNATURE-----

iHUEARYKAB0WIQRlgHNhO/zFx+LkXUXcUY/If5cWqgUCXFzcqgAKCRDcUY/If5cW
qol8APoDPr4QepdOX2GPRqwkOdJ/xWFR/7V0RMbAGK5Z5neXkgEA6nTByGsNqHHx
Kx7AelUtJibCLFhbov9Ixri41NQtxAU=
=QKEz
-----END PGP SIGNATURE-----

Vagrant Cascadian wrote 6 years ago
(address . 34377@debbugs.gnu.org)
87k1ib6jsv.fsf@ponder
Quick fix/workaround is the following patch, simply overwriting the
wrapped trezor_agent.py with the real thing.

live well,
vagrant

commit ef39a4dc42dcd2daaa7a626c923f1115f8540091
Author: Vagrant Cascadian <vagrant@debian.org>
Date: Fri Feb 8 03:23:14 2019 +0000

trezor-agent: Overwrite trezor_agent.py wrapper with real thing.

Toggle diff (22 lines)
diff --git a/gnu/packages/finance.scm b/gnu/packages/finance.scm
index 035f6f5965..88b365dfb7 100644
--- a/gnu/packages/finance.scm
+++ b/gnu/packages/finance.scm
@@ -805,6 +805,17 @@ Then set the environment variable GNUPGHOME to
(sha256
(base32
"144657c7bn0a667dq5fv5r6j7iilxf3h9agj29v1m2qpq40g0az8"))))
+ (arguments
+ ;; Tests fail with "AttributeError: module 'attr' has no attribute 's'".
+ `(#:phases
+ (modify-phases %standard-phases
+ (add-after 'wrap 'fixup-agent-py
+ (lambda* (#:key inputs outputs #:allow-other-keys)
+ (let* ((out (assoc-ref outputs "out")))
+ ;; overwrite the wrapper with the real thing.
+ (install-file "./trezor_agent.py"
+ (string-append out "/bin/"))
+ #t))))))
(build-system python-build-system)
(inputs
`(("python-trezor" ,python-trezor)
-----BEGIN PGP SIGNATURE-----

iHUEARYKAB0WIQRlgHNhO/zFx+LkXUXcUY/If5cWqgUCXFz3QQAKCRDcUY/If5cW
qv5fAQCUKe278zg/hb93RcoGCTd21fXhOu+3uCJQUq2gFpUXNgD9Fu3mGhdbZn/L
WjVa9tq3m1Np65zr4uCFWcVhj0ObaAk=
=OELS
-----END PGP SIGNATURE-----

Danny Milosavljevic wrote 6 years ago
(no subject)
(address . control@debbugs.gnu.org)
20190226153731.38996f79@scratchpost.org
close 34377
-----BEGIN PGP SIGNATURE-----

iQEzBAEBCAAdFiEEds7GsXJ0tGXALbPZ5xo1VCwwuqUFAlx1TysACgkQ5xo1VCww
uqXrRQgAnPiVzmWL29Q2p8KPRBy2jmc13/9Yk7fwdW1zBqae3HGt9lrhRnBXbQwQ
4Zs9U4ay7y3GQPkCZKweJq/gUcXI7Nwj0VMzrVBHkCPHHpgSCm5Hi28RT98DCY0z
LNT3HL/MfkeLPQdWZv1WIZToeYXqFpBGL7LKoS6fFcciAHRtXJe1v7effAx1QkNV
KSm5bAIDcRgRaBKKmWr9+lCxz/zsRLjStX6K9tdJxeB5AdMlGfyK9gs+myDYG1a1
D7027KDg2SW+mFIV27QmnstEVRFdNPMPJmRfpmhwnZuYBf7wKZt+Pqx6Z3GQNSZ2
I2t3CCJuGS7FZk+3WP6ISqx2Aho/OA==
=MbUq
-----END PGP SIGNATURE-----


?
Your comment

This issue is archived.

To comment on this conversation send an email to 34377@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 34377
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch
You may also tag this issue. See list of standard tags. For example, to set the confirmed and easy tags
mumi command -t +confirmed -t +easy
Or, remove the moreinfo tag and set the help tag
mumi command -t -moreinfo -t +help