Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 710500 - app-backup/duplicity-0.8.09-r1 ModuleNotFoundError: No module named 'fasteners'
Summary: app-backup/duplicity-0.8.09-r1 ModuleNotFoundError: No module named 'fasteners'
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Richard Freeman
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-02-22 16:41 UTC by Ralph Seichter
Modified: 2020-05-07 18:05 UTC (History)
1 user (show)

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


Attachments
duplicity-0.8.12.1612.ebuild.patch (duplicity-0.8.12.1612.ebuild.patch,551 bytes, text/plain)
2020-05-07 11:26 UTC, Alexander Tsoy
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ralph Seichter 2020-02-22 16:41:46 UTC
The attempt to launch duplicity results in the following error:

$ duplicity
Traceback (most recent call last):
  File "/usr/bin/duplicity", line 40, in <module>
    import fasteners
ModuleNotFoundError: No module named 'fasteners'

$ equery l duplicity
 * Searching for duplicity ...
[IP-] [  ] app-backup/duplicity-0.8.09-r1:0

$ equery u duplicity
[ Legend : U - final flag setting for installation]
[        : I - package is installed with flag     ]
[ Colors : set, unset                             ]
 * Found these USE flags for app-backup/duplicity-0.8.09-r1:
 U I
 + + python_targets_python2_7 : Build with Python 2.7
 + + python_targets_python3_6 : Build with Python 3.6
 - - s3                       : Support for backing up to the Amazon S3 system
 - - test                     : Enable dependencies and/or preparations necessary to run tests (usually controlled by FEATURES=test but can
                                be toggled independently)
Comment 1 Ralph Seichter 2020-02-22 16:45:19 UTC
See also https://bugs.gentoo.org/705726 . This type of bug should be detected during testing, should it not?
Comment 2 Richard Freeman gentoo-dev 2020-02-22 18:52:32 UTC
(In reply to Ralph Seichter from comment #1)
> See also https://bugs.gentoo.org/705726 . This type of bug should be
> detected during testing, should it not?

Indeed, thanks for testing!
Comment 3 Richard Freeman gentoo-dev 2020-02-22 18:58:05 UTC
Actually, this is a bit bizarre.  

You do have dev-python/fasteners installed, right?

It is actually a dependency in the package, so emerge shouldn't install duplicity unless you have it installed.  Of course, you could install it manually in some way and skip dependency resolution, in which case it would break.

Feel free to re-open with this info.
Comment 4 Ralph Seichter 2020-02-22 18:59:21 UTC
(In reply to Richard Freeman from comment #2)

> Indeed, thanks for testing!
If by "testing" you mean "having the updated ebuild automatically installed and later realising that system backups no longer work", you're welcome. ;-)

Seriously though: Is there no test process involved, CI-based or other, that catches these obvious problems? If I, as a proxy maintainer, wanted to add changes with unmet dependencies to the Gentoo tree, somebody would probably notice (and possibly give me a slap on the wrist).
Comment 5 Ralph Seichter 2020-02-22 19:02:19 UTC
(In reply to Richard Freeman from comment #3)

> You do have dev-python/fasteners installed, right?
Looks like it:

$ equery l dev-python/fasteners
 * Searching for fasteners in dev-python ...
[IP-] [  ] dev-python/fasteners-0.14.1-r1:0

$ equery u dev-python/fasteners
[ Legend : U - final flag setting for installation]
[        : I - package is installed with flag     ]
[ Colors : set, unset                             ]
 * Found these USE flags for dev-python/fasteners-0.14.1-r1:
 U I
 + + python_targets_python2_7 : Build with Python 2.7
 + + python_targets_python3_6 : Build with Python 3.6
 + + python_targets_python3_7 : Build with Python 3.7
 - - test                     : Enable dependencies and/or preparations necessary to run tests (usually controlled by FEATURES=test but can be toggled
                                independently)
Comment 6 Richard Freeman gentoo-dev 2020-02-22 19:04:59 UTC
(In reply to Ralph Seichter from comment #4)
> (In reply to Richard Freeman from comment #2)
> 
> > Indeed, thanks for testing!
> If by "testing" you mean "having the updated ebuild automatically installed
> and later realising that system backups no longer work", you're welcome. ;-)
> 
> Seriously though: Is there no test process involved, CI-based or other, that
> catches these obvious problems? If I, as a proxy maintainer, wanted to add
> changes with unmet dependencies to the Gentoo tree, somebody would probably
> notice (and possibly give me a slap on the wrist).

So, in this case there are no unmet dependencies that I'm aware of.

However, in general I'm not aware of any tools that detect unspecified python dependencies.  If you're aware of any I'm all ears.  I've certainly seen scripts that detect unspecified linked dependencies for binaries and do use them routinely.

What we do have is a workflow where only users who volunteer to test packages get exposed to new packages, as you did by accepting the ~arch keyword.  :)

In any case - if there is something wrong with the ebuild I'm more than happy to fix it.  Certainly I wouldn't like broken backups either, and I rely on this package daily myself.
Comment 7 Richard Freeman gentoo-dev 2020-02-22 19:08:01 UTC
(In reply to Ralph Seichter from comment #5)
> (In reply to Richard Freeman from comment #3)
> 
> > You do have dev-python/fasteners installed, right?
> Looks like it:
> 

Interesting.  Not sure what is going on there.  Seems like both packages were built for python 2.7/3.6.
Comment 8 Ralph Seichter 2020-02-22 19:14:37 UTC
(In reply to Richard Freeman from comment #6)

> in general I'm not aware of any tools that detect unspecified
> python dependencies. If you're aware of any I'm all ears.
In case that sounded odd: I had no intention of chastising you. I am genuinely interested in whether or not there are CI processes that can pick up these issues.

I write a lot of software in Python and have just today opened a pull request for a new package (app-antivirus/fangfrisch). I rely on Larry the Cow and the proxy maintainers' watchful eyes to pick up possible errors in ebuilds.
Comment 9 Richard Freeman gentoo-dev 2020-02-22 19:44:05 UTC
No offense taken, and if you do learn of some tool I'm all ears.  Auditing python dependencies is certainly something that would be useful.

What would help is if we had a container/jail/etc-based build system that prevented packages from accessing non-deps during build.  Though that wouldn't help with a runtime issue which a python issue is more likely to be.  Something like this for runtime wouldn't hurt.

In this case though I have no idea what is going on, as you have the package installed and it is listed as a dep.  Obviously there is some sort of issue.  I'm not running into it personally.

Maybe I'll try to play around in a minimal container with it...
Comment 10 Ralph Seichter 2020-03-06 19:19:14 UTC
The error is still present with app-backup/duplicity-0.8.11.1596:0
Comment 11 Richard Freeman gentoo-dev 2020-03-29 15:59:40 UTC
Ok, please report whether this persists with 0.8.12.1612.
Comment 12 Ralph Seichter 2020-03-30 13:47:12 UTC
Sadly, the problem persists.

$ equery l duplicity
 * Searching for duplicity ...
[IP-] [  ] app-backup/duplicity-0.8.12.1612:0

$ duplicity
Traceback (most recent call last):
  File "/usr/bin/duplicity", line 39, in <module>
    import fasteners
ModuleNotFoundError: No module named 'fasteners'
Comment 13 Alexander Tsoy 2020-05-07 10:58:12 UTC
The problem is that duplicity executables are not wrapped with python-exec:

$ head -n1 /usr/bin/duplicity /usr/bin/rdiffdir
==> /usr/bin/duplicity <==
#!/usr/bin/env python3

==> /usr/bin/rdiffdir <==
#!/usr/bin/env python3

So if selected python version is not in PYTHON_TARGETS duplicity was built with, it will not work.

I see two possible solutions:
1. Support only single python target (DISTUTILS_SINGLE_IMPL) and fix shebangs (python_fix_shebang()).
2. Wrap executables with python-exec (python_doexe()). But do we really need to support multiple python targets in duplicity?
Comment 14 Alexander Tsoy 2020-05-07 11:26:13 UTC
Created attachment 636696 [details]
duplicity-0.8.12.1612.ebuild.patch

OK, the easiest solution seems to just wrap all executables. Please try attached patch.
Comment 15 Larry the Git Cow gentoo-dev 2020-05-07 16:53:15 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d554635fb1e0683395b6cf1c8ac205e8c9bc0327

commit d554635fb1e0683395b6cf1c8ac205e8c9bc0327
Author:     Richard Freeman <rich0@gentoo.org>
AuthorDate: 2020-05-07 16:30:52 +0000
Commit:     Richard Freeman <rich0@gentoo.org>
CommitDate: 2020-05-07 16:52:46 +0000

    app-backup/duplicity: setup.py fix to allow python-exec wrapping
    
    Thanks to Alexander who discovered the root cause of this problem.
    
    Credit: Alexander Tsoy
    Closes: https://bugs.gentoo.org/710500
    Package-Manager: Portage-2.3.99, Repoman-2.3.22
    Signed-off-by: Richard Freeman <rich0@gentoo.org>

 .../duplicity/duplicity-0.8.12.1612-r1.ebuild      | 50 ++++++++++++++++++++++
 .../files/duplicity-0.8.12.1612-fix-docs-cmd.patch | 29 +++++++++++++
 2 files changed, 79 insertions(+)
Comment 16 Richard Freeman gentoo-dev 2020-05-07 16:55:09 UTC
Please test this to confirm that it fixes your issue.  I think you correctly identified the root cause, but better fix was to patch setup.py, which apparently was designed to block shebang editing/etc.  

Let me know if this works though, as I'd like to get this stabilized as it is blocking the python migration.  I did testing and confirm that it works, but I wasn't the one with the problem...
Comment 17 Alexander Tsoy 2020-05-07 17:41:08 UTC
Thanks! It fixed my issue. I didn't notice that it was a problem in setup.py.
Comment 18 Richard Freeman gentoo-dev 2020-05-07 18:05:12 UTC
(In reply to Alexander Tsoy from comment #17)
> Thanks! It fixed my issue. I didn't notice that it was a problem in setup.py.

Yeah, floppym gets the credit for spotting that.  However, I figured from reading the distutils-r1 docs that something was going wrong with setup.py since that is supposed to wrap everything already.  There are no other packages using distutils which use doexe either.