Bug 264657 - security/libpwquality: broken python bindings
Summary: security/libpwquality: broken python bindings
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-desktop (Team)
URL:
Keywords:
Depends on: 267949
Blocks:
  Show dependency treegraph
 
Reported: 2022-06-13 13:15 UTC by Jason Beech-Brandt
Modified: 2022-12-06 18:19 UTC (History)
7 users (show)

See Also:
tcberner: maintainer-feedback+


Attachments
Go over the install error (520 bytes, patch)
2022-07-26 07:23 UTC, Henri Hennebert
no flags Details | Diff
fix package stage (1.75 KB, patch)
2022-09-15 22:02 UTC, Chad Jacob Milios
no flags Details | Diff
ports make stage check-orphans (36.26 KB, text/plain)
2022-10-15 00:51 UTC, alt2600
no flags Details
poudriere success build log (44.51 KB, text/plain)
2022-10-15 00:51 UTC, alt2600
no flags Details
fix package stage (2.13 KB, patch)
2022-10-15 15:28 UTC, Chad Jacob Milios
milios: maintainer-approval?
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jason Beech-Brandt 2022-06-13 13:15:46 UTC
"make install" in security/libpwquality leads to:

===>   Registering installation for libpwquality-1.4.4
pkg-static: Unable to access file /usr/ports/security/libpwquality/work/stage/usr/local/lib/python3.8/site-packages/pwquality-1.4.4-py3.8.egg-info:No such file or directory
pkg-static: Unable to access file /usr/ports/security/libpwquality/work/stage/usr/local/lib/python3.8/site-packages/pwquality.cpython-38.so:No such file or directory
*** Error code 1
Comment 1 Anders Bolt-Evensen 2022-07-21 14:52:39 UTC
Can confirm the problem.

FreeBSD Version: 14-CURRENT

Tried with portmaster -DBg security/libpwquality.
Comment 2 Anders Bolt-Evensen 2022-07-21 15:00:29 UTC
It also applies to Python 3.9: 
pkg-static: Unable to access file /usr/ports/security/libpwquality/work/stage/usr/local/lib/python3.9/site-packages/pwquality-1.4.4-py3.9.egg-info:No such file or directory
pkg-static: Unable to access file /usr/ports/security/libpwquality/work/stage/usr/local/lib/python3.9/site-packages/pwquality.cpython-39.so:No such file or directory
Comment 3 Anders Bolt-Evensen 2022-07-21 17:18:14 UTC
It seems like pkg looks for pwquality.cpython-39.so in /usr/ports/security/libpwquality/work/stage/usr/local/lib/python3.9/site-packages/ instead of the correct /usr/ports/security/libpwquality/work/stage/usr/local/lib/python3.9/site-packages/pwquality-1.4.4-py3.9-freebsd-$VERSION-amd64.egg/

As for the other file, pwquality-1.4.4-py3.9.egg-info, could that be this directory:
/usr/ports/security/libpwquality/work/stage/usr/local/lib/python3.9/site-packages/pwquality-1.4.4-py3.9-freebsd-14.0-CURRENT-amd64.egg/EGG-INFO/ ?
Comment 4 Henri Hennebert 2022-07-26 07:23:32 UTC
Created attachment 235476 [details]
Go over the install error

With this patch I can install libpwquality and continue other install

This is just a temporary hack
Comment 5 Henri Hennebert 2022-07-26 07:26:46 UTC
Comment on attachment 235476 [details]
Go over the install error

After the patch you must `make clean` before `make install clean`
Comment 6 Anders Bolt-Evensen 2022-08-04 09:24:02 UTC
(In reply to Henri Hennebert from comment #5)
Thank you. Can confirm your suggestion works and the package compiles and installs just fine now. :)
Comment 7 Jason Beech-Brandt 2022-09-07 08:17:23 UTC
this patch works for me
Comment 8 Chad Jacob Milios 2022-09-15 22:02:52 UTC
Created attachment 236583 [details]
fix package stage

this patch is better
Comment 9 alt2600 2022-10-14 03:21:27 UTC
so much for installing gnome from ports. didn't try either proposed patch, it would seem the orphans should be installed for python though. Just adding this is broken from 13.1p2 as well as Current.

computer@/usr/ports/security/libpwquality|$ sudo make check-orphans
Password:
====> Checking for pkg-plist issues (check-plist)
===> Parsing plist
===> Checking for items in STAGEDIR missing from pkg-plist
Error: Orphaned: %%PYTHON_SITELIBDIR%%/pwquality-1.4.4-py%%PYTHON_VER%%-freebsd-13.1-RELEASE-p2-amd64.egg/EGG-INFO/PKG-INFO
Error: Orphaned: %%PYTHON_SITELIBDIR%%/pwquality-1.4.4-py%%PYTHON_VER%%-freebsd-13.1-RELEASE-p2-amd64.egg/EGG-INFO/SOURCES.txt
Error: Orphaned: %%PYTHON_SITELIBDIR%%/pwquality-1.4.4-py%%PYTHON_VER%%-freebsd-13.1-RELEASE-p2-amd64.egg/EGG-INFO/dependency_links.txt
Error: Orphaned: %%PYTHON_SITELIBDIR%%/pwquality-1.4.4-py%%PYTHON_VER%%-freebsd-13.1-RELEASE-p2-amd64.egg/EGG-INFO/native_libs.txt
Error: Orphaned: %%PYTHON_SITELIBDIR%%/pwquality-1.4.4-py%%PYTHON_VER%%-freebsd-13.1-RELEASE-p2-amd64.egg/EGG-INFO/not-zip-safe
Error: Orphaned: %%PYTHON_SITELIBDIR%%/pwquality-1.4.4-py%%PYTHON_VER%%-freebsd-13.1-RELEASE-p2-amd64.egg/EGG-INFO/top_level.txt
Error: Orphaned: %%PYTHON_SITELIBDIR%%/pwquality-1.4.4-py%%PYTHON_VER%%-freebsd-13.1-RELEASE-p2-amd64.egg/__pycache__/pwquality%%PYTHON_EXT_SUFFIX%%.pyc
Error: Orphaned: %%PYTHON_SITELIBDIR%%/pwquality-1.4.4-py%%PYTHON_VER%%-freebsd-13.1-RELEASE-p2-amd64.egg/pwquality%%PYTHON_EXT_SUFFIX%%.so
Error: Orphaned: %%PYTHON_SITELIBDIR%%/pwquality-1.4.4-py%%PYTHON_VER%%-freebsd-13.1-RELEASE-p2-amd64.egg/pwquality.py
===> Checking for items in pkg-plist which are not in STAGEDIR
Error: Missing: %%PYTHON_SITELIBDIR%%/pwquality-1.4.4-py%%PYTHON_VER%%.egg-info
Error: Missing: %%PYTHON_SITELIBDIR%%/pwquality%%PYTHON_EXT_SUFFIX%%.so
===> Error: Plist issues found.
*** Error code 1

Stop.
make: stopped in /usr/ports/security/libpwquality


computer@/usr/ports/security/libpwquality|$ sudo make install clean
===>  Installing for libpwquality-1.4.4
===>  Checking if libpwquality is already installed
===>   Registering installation for libpwquality-1.4.4
pkg-static: Unable to access file /usr/ports/security/libpwquality/work/stage/usr/local/lib/python3.9/site-packages/pwquality-1.4.4-py3.9.egg-info:No such file or directory
pkg-static: Unable to access file /usr/ports/security/libpwquality/work/stage/usr/local/lib/python3.9/site-packages/pwquality.cpython-39.so:No such file or directory
*** Error code 1

Stop.
make: stopped in /usr/ports/security/libpwquality
Comment 10 Tobias C. Berner freebsd_committer freebsd_triage 2022-10-14 07:10:04 UTC
Moin moin 

I'm unable to reproduce this on my end.

Could you provide a full build log, that may shed some more light on this?


mfg Tobias
Comment 11 Dima Panov freebsd_committer freebsd_triage 2022-10-14 15:32:22 UTC
Use poudriere, Luke! Come to the dark side of the power, we have a milk and cookies ;)

I see here a side effect of partial py??-* packages upgrade when switching default python version from 3.8 to 3.9. 

Always, ALWAYS do a full rebuild/reinstall of any py??-* package when default is changed. Because staled installed packages have hardcoded py version inside. And it's a reason why error cannot be reproduced in clean poudriere environment with built-from-scratch repo.
Comment 12 alt2600 2022-10-15 00:39:23 UTC
(In reply to Dima Panov from comment #11)

once this section is patched out, and something as simple as portconf works for a poudriere thats in the freebsd-src.git :^)

https://docs.freebsd.org/en/books/handbook/ports/#ports-using

all kidding aside while I do have some py27 floating around, in my case this is not an upgrade. but i did gleam something I cannot understand that I will be replaying to Tobias's log request.
Comment 13 alt2600 2022-10-15 00:50:28 UTC
(In reply to Tobias C. Berner from comment #10)

I'll add two logs, one from ports, one from poudriere, same portstree is used by both, same distfiles too. What you will notice in the staging area is the difference

in ports
PYTHONPATH is set to '' and seemingly messing up the installation to the staging area. I have no idea where this is coming in from, I am not setting it anywhere, and I cannot grep it out of ports/MK . seemingly this isn't set when PACKAGE_BUILDING is set, as I believe is the default poudriere setting used by the official repos, and I never changed this from the default setting of being set in my builder. I think I have seen this behavior in the past once in a while, but I cannot recall where and if it completely busted things for me or not. Not even sure this is the root issue, but it is a glaring difference in the staging logs. Its not in my user env, nor root's, I have no idea what is bringing it in, and why its seemingly clean in poudriere but not from ports. see line 351 of the ports build log where the deltas seem to appear

in poudriere this isn't seemingly being set by anything. and I apologize, I tried to scrub the exotic name I use for my package builder system, and it looks like its clean. it wouldn't be totally offensive, just slightly potentially off putting to some.
Comment 14 alt2600 2022-10-15 00:51:11 UTC
Created attachment 237312 [details]
ports make stage check-orphans
Comment 15 alt2600 2022-10-15 00:51:33 UTC
Created attachment 237313 [details]
poudriere success build log
Comment 16 alt2600 2022-10-15 04:44:53 UTC
further spelunking suggests maybe the issue is py-setuptools and this port maybe doing a legacy install from ports. 

https://github.com/pypa/setuptools/issues/3431

going to see if I can make more sense of this and see if I can elegantly have it ignore setuptools.

I did see PYTHONPATH defined all over site-packages, but it is specifically set to be '' in _sysconfigdata__freebsd13_.py installed by python 3.9 itself.

this port makes no reference to wanting to use py-setuptools, so that may be why things work under poudriere fine.
Comment 17 alt2600 2022-10-15 05:31:15 UTC
sorry about so many posts.

if py39-setuptools is deleted the port builds and stages with no orphans. py-setuptools being installed breaks this port, which is awesome as I have no clue how to turn it off without deleting it. and it seemingly is necessary for other py- ports. but if you have it you cannot install gnome from ports unless you do py-libpwquality first, and never have to upgrade/rebuild it. time for some scotch, need someone who understands how this python fun works to offer some guidance unless I get some drunken epiphany.
Comment 18 Chad Jacob Milios 2022-10-15 15:28:11 UTC
Created attachment 237338 [details]
fix package stage

(In reply to alt2600 from comment #17)

Thank you for digging to the root of the problem!

Here ya go, try this.
Comment 19 alt2600 2022-10-15 18:14:37 UTC
(In reply to Chad Jacob Milios from comment #18)

applying the Fix Packaging Stage attachment: the post-stage hooks do not work, and it still throws errors about installing using setup.py during the normal staging of the port. I cannot even get to checking orphans. I don't think adding setuptools to the dependency will help, this port seemingly cannot use them at all to stage properly. Thinking we have too old a version of setuptools, it seems the version we have is marked deprecated and slated for removal at python 3.12 if I'm reading things right online and in the logs. We are on 0.63.1.0 and they are on 0.65.5.0 upstream. its presence is the issue, as it works fine without it under a clean poudriere jail. Not sure if gnome wants python bindings or not, but I sure don't care to have my password critiqued so I might just get rid of the python bindings to keep going. I might also see if I can bump my py-setuptools version without too much hassle, but I would imagine that could be a huge ordeal for all the dependent modules if they are version locked instead of minimally chosen as done in your patch. And not sure if they would like the new version, and not looking to brick my desktop testing, nor having to roll back zfs snapshots. I'll surely continue to help testing, to the extent it doesn't put my production system at risk. time for more scotch, and I'll look into if bumping setuptools resolves this issue at least, it seemingly will be needed for ports in the long run as python 3 marches on minor revs. fortunately i have a wide number of py-setuptools dependent py- ports I can test in poudriere without risk to my production system if the bump process goes smooth.


cp -f -R /usr/ports/security/libpwquality/work/stage/usr/local/lib/python3.9/site-packages/pwquality-1.4.4_1-py3.9-freebsd-13.1-RELEASE-p2-amd64.egg/EGG-INFO /usr/ports/security/libpwquality/work/stage/usr/local/lib/python3.9/site-packages/pwquality-1.4.4_1-py3.9.egg-info
cp: /usr/ports/security/libpwquality/work/stage/usr/local/lib/python3.9/site-packages/pwquality-1.4.4_1-py3.9-freebsd-13.1-RELEASE-p2-amd64.egg/EGG-INFO: No such file or directory
*** Error code 1


when I delete the post-stage hooks in the there are now more orphans, there are no orphans or plist issues if setuptools is not installed at all. so I don't think the plist has issue, its the inability to easily disable/exclude site-packages from build environments that is the problem. Reading about suggest no one in the python project ever considered needing to do anything but add modules, not delete/block them from pythons execution scope, as there are only include and similar directives, no excludes. python alone might be what drives me to full time poudriere instead of just for i386 wine, and occasional aarch64 cross compiling... :^)

====> Checking for pkg-plist issues (check-plist)
===> Parsing plist
===> Checking for items in STAGEDIR missing from pkg-plist
Error: Orphaned: %%PYTHON_SITELIBDIR%%/pwquality-1.4.4-py%%PYTHON_VER%%-freebsd-13.1-RELEASE-p2-amd64.egg/EGG-INFO/PKG-INFO
Error: Orphaned: %%PYTHON_SITELIBDIR%%/pwquality-1.4.4-py%%PYTHON_VER%%-freebsd-13.1-RELEASE-p2-amd64.egg/EGG-INFO/SOURCES.txt
Error: Orphaned: %%PYTHON_SITELIBDIR%%/pwquality-1.4.4-py%%PYTHON_VER%%-freebsd-13.1-RELEASE-p2-amd64.egg/EGG-INFO/dependency_links.txt
Error: Orphaned: %%PYTHON_SITELIBDIR%%/pwquality-1.4.4-py%%PYTHON_VER%%-freebsd-13.1-RELEASE-p2-amd64.egg/EGG-INFO/native_libs.txt
Error: Orphaned: %%PYTHON_SITELIBDIR%%/pwquality-1.4.4-py%%PYTHON_VER%%-freebsd-13.1-RELEASE-p2-amd64.egg/EGG-INFO/not-zip-safe
Error: Orphaned: %%PYTHON_SITELIBDIR%%/pwquality-1.4.4-py%%PYTHON_VER%%-freebsd-13.1-RELEASE-p2-amd64.egg/EGG-INFO/top_level.txt
Error: Orphaned: %%PYTHON_SITELIBDIR%%/pwquality-1.4.4-py%%PYTHON_VER%%-freebsd-13.1-RELEASE-p2-amd64.egg/__pycache__/pwquality%%PYTHON_EXT_SUFFIX%%.pyc
Error: Orphaned: %%PYTHON_SITELIBDIR%%/pwquality-1.4.4-py%%PYTHON_VER%%-freebsd-13.1-RELEASE-p2-amd64.egg/pwquality%%PYTHON_EXT_SUFFIX%%.so
Error: Orphaned: %%PYTHON_SITELIBDIR%%/pwquality-1.4.4-py%%PYTHON_VER%%-freebsd-13.1-RELEASE-p2-amd64.egg/pwquality.py
===> Checking for items in pkg-plist which are not in STAGEDIR
Error: Missing: %%PYTHON_SITELIBDIR%%/pwquality-1.4.4-py%%PYTHON_VER%%.egg-info/PKG-INFO
Error: Missing: %%PYTHON_SITELIBDIR%%/pwquality-1.4.4-py%%PYTHON_VER%%.egg-info/SOURCES.txt
Error: Missing: %%PYTHON_SITELIBDIR%%/pwquality-1.4.4-py%%PYTHON_VER%%.egg-info/dependency_links.txt
Error: Missing: %%PYTHON_SITELIBDIR%%/pwquality-1.4.4-py%%PYTHON_VER%%.egg-info/native_libs.txt
Error: Missing: %%PYTHON_SITELIBDIR%%/pwquality-1.4.4-py%%PYTHON_VER%%.egg-info/not-zip-safe
Error: Missing: %%PYTHON_SITELIBDIR%%/pwquality-1.4.4-py%%PYTHON_VER%%.egg-info/top_level.txt
Error: Missing: %%PYTHON_SITELIBDIR%%/pwquality%%PYTHON_EXT_SUFFIX%%.so
===> Error: Plist issues found.
*** Error code 1
Comment 20 alt2600 2022-10-15 20:25:55 UTC
so bumping py-setuptools to 65.5.0 doesn't fix anything

so no idea how to make this happy short of turning off the bindings. I'm digging through Mk/Uses/python.mk but nothing is sticking out to me, as I have never had any luck doing anything with python because it usually ends with errors like these. I'm looking at maybe pip install, but no idea how to hack that in. 



/usr/local/lib/python3.9/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
  warnings.warn(
/usr/local/lib/python3.9/site-packages/setuptools/command/easy_install.py:144: EasyInstallDeprecationWarning: easy_install command is deprecated. Use build and pip and other standards-based tools.
  warnings.warn(
Checking .pth file support in /usr/ports/security/libpwquality/work/stage/usr/local/lib/python3.9/site-packages/
/usr/local/bin/python3.9 -E -c pass
TEST FAILED: /usr/ports/security/libpwquality/work/stage/usr/local/lib/python3.9/site-packages/ does NOT support .pth files
bad install directory or PYTHONPATH

You are attempting to install a package to a directory that is not
on PYTHONPATH and which Python does not read ".pth" files from.  The
installation directory you specified (via --install-dir, --prefix, or
the distutils default setting) was:

    /usr/ports/security/libpwquality/work/stage/usr/local/lib/python3.9/site-packages/

and your PYTHONPATH environment variable currently contains:

    ''

Here are some of your options for correcting the problem:

* You can choose a different installation directory, i.e., one that is
  on PYTHONPATH or supports .pth files

* You can add the installation directory to the PYTHONPATH environment
  variable.  (It must then also be on PYTHONPATH whenever you run
  Python and want to use the package(s) you are installing.)

* You can set up the installation directory to support ".pth" files by
  using one of the approaches described here:

  https://setuptools.pypa.io/en/latest/deprecated/easy_install.html#custom-installation-locations
Comment 21 Chad Jacob Milios 2022-10-15 20:30:17 UTC
Hmmm. Well thank you for all the hard work. I guess i should have mentioned i'm using

DEFAULT_VERSIONS= python=3.10 python3=3.10

and only tested my patch with 13.1p2, py310-setuptools-63.1.0 and a whole mess of other pkgs installed. it will be a great while before i can look at this again with any variety of other versions
Comment 22 alt2600 2022-10-15 22:56:30 UTC
(In reply to Chad Jacob Milios from comment #21)


I appreciate that so I gave it one more go, as it should work for 3.9 if it worked for you under 3.10, and I'll admit I did not use your patch exactly. In my laziness of wanting to test poudriere next I added PORTREVISION=1 before trying not thinking of your post-stage hook to force an update without wiping my whole dependency tree out. That is what broke your patch, it was me. It still is showing orphan staged files, but your patch as is stages and packages ok. So I think it may just need the tweaks to accommodate PORTREVISION being set in the future. There are still these orphaned staged files, but not orphaned plist files. not sure the name to use, and I'm only mangling hacking PORTREVISION into your hook myself.

but it installs, and it still builds in poudriere, with basically identical build logs to ports. only future issue is if PORTREVISION is introduced. but that is arguably tomorrows problem, as its working now. Thank you for getting this working for me though.

====> Compressing man pages (compress-man)
====> Checking for pkg-plist issues (check-plist)
===> Parsing plist
===> Checking for items in STAGEDIR missing from pkg-plist
Error: Orphaned: %%PYTHON_SITELIBDIR%%/pwquality-1.4.4-py%%PYTHON_VER%%-freebsd-13.1-RELEASE-p2-amd64.egg/EGG-INFO/PKG-INFO
Error: Orphaned: %%PYTHON_SITELIBDIR%%/pwquality-1.4.4-py%%PYTHON_VER%%-freebsd-13.1-RELEASE-p2-amd64.egg/EGG-INFO/SOURCES.txt
Error: Orphaned: %%PYTHON_SITELIBDIR%%/pwquality-1.4.4-py%%PYTHON_VER%%-freebsd-13.1-RELEASE-p2-amd64.egg/EGG-INFO/dependency_links.txt
Error: Orphaned: %%PYTHON_SITELIBDIR%%/pwquality-1.4.4-py%%PYTHON_VER%%-freebsd-13.1-RELEASE-p2-amd64.egg/EGG-INFO/native_libs.txt
Error: Orphaned: %%PYTHON_SITELIBDIR%%/pwquality-1.4.4-py%%PYTHON_VER%%-freebsd-13.1-RELEASE-p2-amd64.egg/EGG-INFO/not-zip-safe
Error: Orphaned: %%PYTHON_SITELIBDIR%%/pwquality-1.4.4-py%%PYTHON_VER%%-freebsd-13.1-RELEASE-p2-amd64.egg/EGG-INFO/top_level.txt
Error: Orphaned: %%PYTHON_SITELIBDIR%%/pwquality-1.4.4-py%%PYTHON_VER%%-freebsd-13.1-RELEASE-p2-amd64.egg/__pycache__/pwquality%%PYTHON_EXT_SUFFIX%%.pyc
Error: Orphaned: %%PYTHON_SITELIBDIR%%/pwquality-1.4.4-py%%PYTHON_VER%%-freebsd-13.1-RELEASE-p2-amd64.egg/pwquality%%PYTHON_EXT_SUFFIX%%.so
Error: Orphaned: %%PYTHON_SITELIBDIR%%/pwquality-1.4.4-py%%PYTHON_VER%%-freebsd-13.1-RELEASE-p2-amd64.egg/pwquality.py
===> Checking for items in pkg-plist which are not in STAGEDIR
===> Error: Plist issues found.
*** Error code 1

Stop.
make: stopped in /usr/ports/security/libpwquality
Comment 23 commit-hook freebsd_committer freebsd_triage 2022-12-06 18:13:04 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=61b8658122ea005efe94171f6009aa0d95ef701b

commit 61b8658122ea005efe94171f6009aa0d95ef701b
Author:     Olivier Duchateau <duchateau.olivier@gmail.com>
AuthorDate: 2022-12-06 14:15:11 +0000
Commit:     Adriaan de Groot <adridg@FreeBSD.org>
CommitDate: 2022-12-06 18:12:10 +0000

    security/libpwquality: update to 1.4.5

    PR:             264657 267949

 security/libpwquality/Makefile                             |  7 +++++--
 security/libpwquality/distinfo                             |  6 +++---
 security/libpwquality/files/patch-python_Makefile.in (new) | 11 +++++++++++
 security/libpwquality/pkg-plist                            |  6 +++++-
 4 files changed, 24 insertions(+), 6 deletions(-)
Comment 24 Adriaan de Groot freebsd_committer freebsd_triage 2022-12-06 18:19:27 UTC
Works now with the update to 1.4.5