Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please replace bsddb3 by berkeleydb according to upstream deprecation notice #61

Closed
AkechiShiro opened this issue May 13, 2024 · 14 comments

Comments

@AkechiShiro
Copy link

from bsddb3 import db

See here : google/nsscache#135

@AkechiShiro
Copy link
Author

This is causing test failure downstream on my side, thanks for fixing this, hopefully the migration is not too complex for this project.

@AkechiShiro
Copy link
Author

I can try to make a PR if needed, or if you're too busy, please let me know.

@sdgathman
Copy link
Owner

sdgathman commented May 24, 2024

bsddb3 is used for the sendmail access file. Has sendmail also moved to berkeleydb ? Or is the underlying library the same, and this is a python wrapper change?

I'm guessing it is a wrapper change only.

@sdgathman
Copy link
Owner

I used to use anydbm - I can't remember why I had to go back to bsddb3 explicitly. Maybe anydbm works again.

@AkechiShiro
Copy link
Author

Please feel free to let me know when you have tried if anydbm works and I'll update the dependencies downstream on my side.

Also I'm not sure if it's just a wrapper change as there were these instruction to migrate old code :

You are running Python 3 and you can update your code from bsddb3 library to berkeleydb library:

The main change you need to be aware is that in berkeleydb keys and values are now bytes, while in bsddb3 they were strings. You would only need to change your code to add or remove type encoding/decoding, depending of how you use the library. The process should be simple.

@sdgathman
Copy link
Owner

anydbm does not work. It is already tried if bsddb3 fails. Adding berkeleydb as another fallback.

@AkechiShiro
Copy link
Author

Was this done in a recent PR, can I close this issue ? @sdgathman

@sdgathman
Copy link
Owner

Have to try combinations of python2.7/3.x and bsddb3/berkeleydb present/absent (anydbm only tries built-in dbms, and bsddb3/berkeleydb was dropped as a builtin). But you can go ahead and drop bsddb3 as a requirement. Since berkeleydb is in Fedora 40 and 39, and bsddb3 is deprecated, it really only needs to be tested for EL8. And I could probably package berkeleydb for EPEL8 if no one else does it first. (EL7 is near EOL and would just use older pymilter)

Here is the result when neither are present:

[stuart@elissa pymilter]$ python3 testpolicy.py
Traceback (most recent call last):
  File "/home/stuart/src/pymilter/Milter/policy.py", line 3, in <module>
    from bsddb3 import db
ModuleNotFoundError: No module named 'bsddb3'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/stuart/src/pymilter/testpolicy.py", line 5, in <module>
    from Milter.policy import MTAPolicy
  File "/home/stuart/src/pymilter/Milter/policy.py", line 5, in <module>
    from berkeleydb import db
ModuleNotFoundError: No module named 'berkeleydb'

@sdgathman
Copy link
Owner

That is the correct result - trying to refresh my memory of how to verify that in a test case. Maybe just concentrate on correct operation when either is present. Preference should be given to berkeleydb I think.

@sdgathman
Copy link
Owner

As you suspected, berkeleydb does not work as a simple rename. Per your hint, will need some key conversion.

@sdgathman
Copy link
Owner

sdgathman commented May 29, 2024

I can't even get berkeleydb to open the access file. Does not accept db.DB_RDONLY. Looking for docs.

berkeleydb.db.DBInvalidArgError: (22, 'Invalid argument -- BDB0004 fop_read_meta: test/access: unexpected file type or format')

If bsddb3 is going away, and berkeleydb can't read sendmail access file, that leaves a knotty problem to solve.

@sdgathman sdgathman reopened this May 29, 2024
@sdgathman
Copy link
Owner

sdgathman commented May 29, 2024

Nevermind, was opening access, not access.db - but still can't get it to find a key. I will try using cursor to list keys as it sees them.

@sdgathman
Copy link
Owner

Working now!

@AkechiShiro
Copy link
Author

Thanks a lot for your work on this !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants