GNU bug report logs - #34377
(ledger|trezor|keepkey)-agent execute shell code with python interpreter

Previous Next

Package: guix;

Reported by: Vagrant Cascadian <vagrant <at> debian.org>

Date: Fri, 8 Feb 2019 01:36:01 UTC

Severity: normal

Done: Danny Milosavljevic <dannym <at> scratchpost.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 34377 in the body.
You can then email your comments to 34377 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-guix <at> gnu.org:
bug#34377; Package guix. (Fri, 08 Feb 2019 01:36:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Vagrant Cascadian <vagrant <at> debian.org>:
New bug report received and forwarded. Copy sent to bug-guix <at> gnu.org. (Fri, 08 Feb 2019 01:36:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Vagrant Cascadian <vagrant <at> debian.org>
To: bug-guix <at> gnu.org
Subject: (ledger|trezor|keepkey)-agent execute shell code with python
 interpreter
Date: Thu, 07 Feb 2019 17:34:33 -0800
[Message part 1 (text/plain, inline)]
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
[signature.asc (application/pgp-signature, inline)]

Information forwarded to bug-guix <at> gnu.org:
bug#34377; Package guix. (Fri, 08 Feb 2019 03:29:02 GMT) Full text and rfc822 format available.

Message #8 received at 34377 <at> debbugs.gnu.org (full text, mbox):

From: Vagrant Cascadian <vagrant <at> debian.org>
To: 34377 <at> debbugs.gnu.org
Subject: Re: bug#34377: (ledger|trezor|keepkey)-agent execute shell code with
 python interpreter
Date: Thu, 07 Feb 2019 19:28:00 -0800
[Message part 1 (text/plain, inline)]
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 <at> debian.org>
Date:   Fri Feb 8 03:23:14 2019 +0000

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

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)
[signature.asc (application/pgp-signature, inline)]

bug closed, send any further explanations to 34377 <at> debbugs.gnu.org and Vagrant Cascadian <vagrant <at> debian.org> Request was from Danny Milosavljevic <dannym <at> scratchpost.org> to control <at> debbugs.gnu.org. (Tue, 26 Feb 2019 14:38:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 27 Mar 2019 11:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 5 years and 29 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.