Git Product home page Git Product logo

Comments (18)

iacchi avatar iacchi commented on May 27, 2024 1

I just realised now that there's a bugfix version downloadable from the mobileread forum: https://www.mobileread.com/forums/showpost.php?p=4157570&postcount=2
maybe it's worth mentioning it here on github as well? One needs to remove the plugin folder from the calibre data folder before attempting to install the bugfix version.

from acsm-calibre-plugin.

Leseratte10 avatar Leseratte10 commented on May 27, 2024 1

Yeah, I should really get around to releasing 0.1.0 with all this fixed. The latest beta version here on Github ( https://github.com/Leseratte10/acsm-calibre-plugin/suites/15775400817/artifacts/900357147 ) also has this bugfix included so that one should work as well. This is the same bug as in #67. All that needs to be done is download the latest alpha version from the Github Actions page which contains a fixed oscrypto version.

from acsm-calibre-plugin.

Leseratte10 avatar Leseratte10 commented on May 27, 2024 1

The link is working fine, but only for users logged in on Github - sadly Github doesn't allow making these links public.

from acsm-calibre-plugin.

iacchi avatar iacchi commented on May 27, 2024

I'm having a similar issue on Linux Debian Sid. I made sure the python3-oscryto package was installed. Unlike freekvh, who's getting a "The library libcrypto could not be found" error, I'm getting the error "Error detecting the version of libcrypto". Here's the complete error stack:

calibre, version 6.28.1
ERRORE: Installazione del Plugin fallita: Si è verificato un problema durante l'installazione di questo plugin. Il plugin sarà ora disinstallato. Per favore, riporta il messaggio di errore che segue nella discussione del forum relativa al plugin e riavvia calibre.

Traceback (most recent call last):
  File "/usr/lib/calibre/calibre/customize/ui.py", line 710, in initialize_plugin
    p.initialize()
  File "calibre_plugins.deacsm.__init__", line 226, in initialize
    from libadobe import createDeviceKeyFile, update_account_path, sendHTTPRequest
  File "/tmp/calibre_6.28.1_tmp_8zcmk_tb/_ccj8qdd.zip/libadobe.py", line 59, in <module>
    from oscrypto import keys
  File "/home/iacopo/.config/calibre/plugins/DeACSM/modules/oscrypto/oscrypto/keys.py", line 5, in <module>
    from ._asymmetric import parse_certificate, parse_private, parse_public
  File "/home/iacopo/.config/calibre/plugins/DeACSM/modules/oscrypto/oscrypto/_asymmetric.py", line 27, in <module>
    from .kdf import pbkdf1, pbkdf2, pkcs12_kdf
  File "/home/iacopo/.config/calibre/plugins/DeACSM/modules/oscrypto/oscrypto/kdf.py", line 9, in <module>
    from .util import rand_bytes
  File "/home/iacopo/.config/calibre/plugins/DeACSM/modules/oscrypto/oscrypto/util.py", line 14, in <module>
    from ._openssl.util import rand_bytes
  File "/home/iacopo/.config/calibre/plugins/DeACSM/modules/oscrypto/oscrypto/_openssl/util.py", line 6, in <module>
    from ._libcrypto import libcrypto, libcrypto_version_info, handle_openssl_error
  File "/home/iacopo/.config/calibre/plugins/DeACSM/modules/oscrypto/oscrypto/_openssl/_libcrypto.py", line 24, in <module>
    from ._libcrypto_ctypes import (
  File "/home/iacopo/.config/calibre/plugins/DeACSM/modules/oscrypto/oscrypto/_openssl/_libcrypto_ctypes.py", line 47, in <module>
    raise LibraryNotFoundError('Error detecting the version of libcrypto')
oscrypto.errors.LibraryNotFoundError: Error detecting the version of libcrypto

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/calibre/calibre/gui2/dialogs/plugin_updater.py", line 729, in _install_clicked
    plugin = add_plugin(zip_path)
             ^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/calibre/calibre/customize/ui.py", line 520, in add_plugin
    plugin = initialize_plugin(plugin, path_to_zip_file, PluginInstallationType.EXTERNAL)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/calibre/calibre/customize/ui.py", line 715, in initialize_plugin
    raise InvalidPlugin((_('Initialization of plugin %s failed with traceback:')
calibre.customize.InvalidPlugin: Inizializzazione del plugin Traceback (most recent call last):
  File "/usr/lib/calibre/calibre/customize/ui.py", line 710, in initialize_plugin
    p.initialize()
  File "calibre_plugins.deacsm.__init__", line 226, in initialize
    from libadobe import createDeviceKeyFile, update_account_path, sendHTTPRequest
  File "/tmp/calibre_6.28.1_tmp_8zcmk_tb/_ccj8qdd.zip/libadobe.py", line 59, in <module>
    from oscrypto import keys
  File "/home/iacopo/.config/calibre/plugins/DeACSM/modules/oscrypto/oscrypto/keys.py", line 5, in <module>
    from ._asymmetric import parse_certificate, parse_private, parse_public
  File "/home/iacopo/.config/calibre/plugins/DeACSM/modules/oscrypto/oscrypto/_asymmetric.py", line 27, in <module>
    from .kdf import pbkdf1, pbkdf2, pkcs12_kdf
  File "/home/iacopo/.config/calibre/plugins/DeACSM/modules/oscrypto/oscrypto/kdf.py", line 9, in <module>
    from .util import rand_bytes
  File "/home/iacopo/.config/calibre/plugins/DeACSM/modules/oscrypto/oscrypto/util.py", line 14, in <module>
    from ._openssl.util import rand_bytes
  File "/home/iacopo/.config/calibre/plugins/DeACSM/modules/oscrypto/oscrypto/_openssl/util.py", line 6, in <module>
    from ._libcrypto import libcrypto, libcrypto_version_info, handle_openssl_error
  File "/home/iacopo/.config/calibre/plugins/DeACSM/modules/oscrypto/oscrypto/_openssl/_libcrypto.py", line 24, in <module>
    from ._libcrypto_ctypes import (
  File "/home/iacopo/.config/calibre/plugins/DeACSM/modules/oscrypto/oscrypto/_openssl/_libcrypto_ctypes.py", line 47, in <module>
    raise LibraryNotFoundError('Error detecting the version of libcrypto')
oscrypto.errors.LibraryNotFoundError: Error detecting the version of libcrypto
 non riuscita con messaggio:
Traceback (most recent call last):
  File "/usr/lib/calibre/calibre/customize/ui.py", line 710, in initialize_plugin
    p.initialize()
  File "calibre_plugins.deacsm.__init__", line 226, in initialize
    from libadobe import createDeviceKeyFile, update_account_path, sendHTTPRequest
  File "/tmp/calibre_6.28.1_tmp_8zcmk_tb/_ccj8qdd.zip/libadobe.py", line 59, in <module>
    from oscrypto import keys
  File "/home/iacopo/.config/calibre/plugins/DeACSM/modules/oscrypto/oscrypto/keys.py", line 5, in <module>
    from ._asymmetric import parse_certificate, parse_private, parse_public
  File "/home/iacopo/.config/calibre/plugins/DeACSM/modules/oscrypto/oscrypto/_asymmetric.py", line 27, in <module>
    from .kdf import pbkdf1, pbkdf2, pkcs12_kdf
  File "/home/iacopo/.config/calibre/plugins/DeACSM/modules/oscrypto/oscrypto/kdf.py", line 9, in <module>
    from .util import rand_bytes
  File "/home/iacopo/.config/calibre/plugins/DeACSM/modules/oscrypto/oscrypto/util.py", line 14, in <module>
    from ._openssl.util import rand_bytes
  File "/home/iacopo/.config/calibre/plugins/DeACSM/modules/oscrypto/oscrypto/_openssl/util.py", line 6, in <module>
    from ._libcrypto import libcrypto, libcrypto_version_info, handle_openssl_error
  File "/home/iacopo/.config/calibre/plugins/DeACSM/modules/oscrypto/oscrypto/_openssl/_libcrypto.py", line 24, in <module>
    from ._libcrypto_ctypes import (
  File "/home/iacopo/.config/calibre/plugins/DeACSM/modules/oscrypto/oscrypto/_openssl/_libcrypto_ctypes.py", line 47, in <module>
    raise LibraryNotFoundError('Error detecting the version of libcrypto')
oscrypto.errors.LibraryNotFoundError: Error detecting the version of libcrypto

from acsm-calibre-plugin.

ezracelli avatar ezracelli commented on May 27, 2024

@freekvh I had the exact same issue, also on NixOS! I'm using an override to tell the custom oscrypto included by this plugin where to find libcrypto:

pkgs.calibre.overrideAttrs (attrs: {
  preFixup = (
    builtins.replaceStrings
      [
        ''
          --prefix PYTHONPATH : $PYTHONPATH \
        ''
      ]
      [
        ''
          --prefix LD_LIBRARY_PATH : ${pkgs.libressl.out}/lib \
          --prefix PYTHONPATH : $PYTHONPATH \
        ''
      ]
      attrs.preFixup
  );
})

I had to use libressl instead of openssl. When I tried openssl, I got the (different) "Error detecting the version of libcrypto" error mentioned above, but libressl worked fine.

WARNING: This will build calibre from scratch on your system, since Nix's cache doesn't include this customization. Builds in about 30 seconds on my desktop machine, but YMMV

from acsm-calibre-plugin.

mtill avatar mtill commented on May 27, 2024

Hi @Leseratte10 , I'm also facing this issue.
Unfortunately, the Link you provided ( https://github.com/Leseratte10/acsm-calibre-plugin/suites/15775400817/artifacts/900357147 ) seems to be broken ?

Best regards and thank you very much for all your efforts
mtill

from acsm-calibre-plugin.

johunb avatar johunb commented on May 27, 2024

Using Calibre 6.29. If I use fixed plugin from here [https://www.mobileread.com/forums/showpost.php?p=4157570&postcount=2], I get this error:
calibre, version 6.29.0
ERROR: Unhandled exception: InvalidPlugin:Initialization of plugin Traceback (most recent call last):
File "calibre/customize/ui.py", line 710, in initialize_plugin
File "calibre_plugins.deacsm.init", line 232, in initialize
deacsmprefs = prefs.DeACSM_Prefs()
AttributeError: module 'calibre_plugins.deacsm.prefs' has no attribute 'DeACSM_Prefs'
failed with traceback:
Traceback (most recent call last):
File "calibre/customize/ui.py", line 710, in initialize_plugin
File "calibre_plugins.deacsm.init", line 232, in initialize
deacsmprefs = prefs.DeACSM_Prefs()
AttributeError: module 'calibre_plugins.deacsm.prefs' has no attribute 'DeACSM_Prefs'

calibre 6.29 embedded-python: True
Linux-6.5.0-kali3-amd64-x86_64-with-glibc2.37 Linux ('64bit', 'ELF')
('Linux', '6.5.0-kali3-amd64', '#1 SMP PREEMPT_DYNAMIC Debian 6.5.6-1kali1 (2023-10-09)')
Python 3.10.1
Interface language: None
Successfully initialized third party plugins: DeDRM (10, 0, 3) && Obok DeDRM (10, 0, 3)
Traceback (most recent call last):
File "calibre/customize/ui.py", line 710, in initialize_plugin
File "calibre_plugins.deacsm.init", line 232, in initialize
deacsmprefs = prefs.DeACSM_Prefs()
AttributeError: module 'calibre_plugins.deacsm.prefs' has no attribute 'DeACSM_Prefs'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "calibre/gui2/preferences/plugins.py", line 325, in add_plugin
File "calibre/customize/ui.py", line 520, in add_plugin
File "calibre/customize/ui.py", line 715, in initialize_plugin
calibre.customize.InvalidPlugin: Initialization of plugin Traceback (most recent call last):
File "calibre/customize/ui.py", line 710, in initialize_plugin
File "calibre_plugins.deacsm.init", line 232, in initialize
deacsmprefs = prefs.DeACSM_Prefs()
AttributeError: module 'calibre_plugins.deacsm.prefs' has no attribute 'DeACSM_Prefs'
failed with traceback:
Traceback (most recent call last):
File "calibre/customize/ui.py", line 710, in initialize_plugin
File "calibre_plugins.deacsm.init", line 232, in initialize
deacsmprefs = prefs.DeACSM_Prefs()
AttributeError: module 'calibre_plugins.deacsm.prefs' has no attribute 'DeACSM_Prefs'

If I use this link: [ https://github.com/Leseratte10/acsm-calibre-plugin/suites/15775400817/artifacts/900357147 I get a download calibre-plugins.zip with same error loading as above

from acsm-calibre-plugin.

johunb avatar johunb commented on May 27, 2024

calibre-migration.plugin.zip causes:

calibre, version 6.29.0
ERROR: Unhandled exception: InvalidPlugin:Initialization of plugin Traceback (most recent call last):
File "calibre/customize/ui.py", line 710, in initialize_plugin
File "calibre_plugins.deacsm.init", line 232, in initialize
deacsmprefs = prefs.DeACSM_Prefs()
AttributeError: module 'calibre_plugins.deacsm.prefs' has no attribute 'DeACSM_Prefs'
failed with traceback:
Traceback (most recent call last):
File "calibre/customize/ui.py", line 710, in initialize_plugin
File "calibre_plugins.deacsm.init", line 232, in initialize
deacsmprefs = prefs.DeACSM_Prefs()
AttributeError: module 'calibre_plugins.deacsm.prefs' has no attribute 'DeACSM_Prefs'

calibre 6.29 embedded-python: True
Linux-6.5.0-kali3-amd64-x86_64-with-glibc2.37 Linux ('64bit', 'ELF')
('Linux', '6.5.0-kali3-amd64', '#1 SMP PREEMPT_DYNAMIC Debian 6.5.6-1kali1 (2023-10-09)')
Python 3.10.1
Interface language: None
Successfully initialized third party plugins: DeDRM (10, 0, 3) && Obok DeDRM (10, 0, 3)
Traceback (most recent call last):
File "calibre/customize/ui.py", line 710, in initialize_plugin
File "calibre_plugins.deacsm.init", line 232, in initialize
deacsmprefs = prefs.DeACSM_Prefs()
AttributeError: module 'calibre_plugins.deacsm.prefs' has no attribute 'DeACSM_Prefs'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "calibre/gui2/preferences/plugins.py", line 325, in add_plugin
File "calibre/customize/ui.py", line 520, in add_plugin
File "calibre/customize/ui.py", line 715, in initialize_plugin
calibre.customize.InvalidPlugin: Initialization of plugin Traceback (most recent call last):
File "calibre/customize/ui.py", line 710, in initialize_plugin
File "calibre_plugins.deacsm.init", line 232, in initialize
deacsmprefs = prefs.DeACSM_Prefs()
AttributeError: module 'calibre_plugins.deacsm.prefs' has no attribute 'DeACSM_Prefs'
failed with traceback:
Traceback (most recent call last):
File "calibre/customize/ui.py", line 710, in initialize_plugin
File "calibre_plugins.deacsm.init", line 232, in initialize
deacsmprefs = prefs.DeACSM_Prefs()
AttributeError: module 'calibre_plugins.deacsm.prefs' has no attribute 'DeACSM_Prefs'

calibre-plugin.zip causes:
calibre, version 6.29.0
ERROR: Unhandled exception: InvalidPlugin:Initialization of plugin Traceback (most recent call last):
File "calibre/customize/ui.py", line 710, in initialize_plugin
File "calibre_plugins.deacsm.init", line 232, in initialize
deacsmprefs = prefs.DeACSM_Prefs()
AttributeError: module 'calibre_plugins.deacsm.prefs' has no attribute 'DeACSM_Prefs'
failed with traceback:
Traceback (most recent call last):
File "calibre/customize/ui.py", line 710, in initialize_plugin
File "calibre_plugins.deacsm.init", line 232, in initialize
deacsmprefs = prefs.DeACSM_Prefs()
AttributeError: module 'calibre_plugins.deacsm.prefs' has no attribute 'DeACSM_Prefs'

calibre 6.29 embedded-python: True
Linux-6.5.0-kali3-amd64-x86_64-with-glibc2.37 Linux ('64bit', 'ELF')
('Linux', '6.5.0-kali3-amd64', '#1 SMP PREEMPT_DYNAMIC Debian 6.5.6-1kali1 (2023-10-09)')
Python 3.10.1
Interface language: None
Successfully initialized third party plugins: DeDRM (10, 0, 3) && Obok DeDRM (10, 0, 3)
Traceback (most recent call last):
File "calibre/customize/ui.py", line 710, in initialize_plugin
File "calibre_plugins.deacsm.init", line 232, in initialize
deacsmprefs = prefs.DeACSM_Prefs()
AttributeError: module 'calibre_plugins.deacsm.prefs' has no attribute 'DeACSM_Prefs'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "calibre/gui2/preferences/plugins.py", line 325, in add_plugin
File "calibre/customize/ui.py", line 520, in add_plugin
File "calibre/customize/ui.py", line 715, in initialize_plugin
calibre.customize.InvalidPlugin: Initialization of plugin Traceback (most recent call last):
File "calibre/customize/ui.py", line 710, in initialize_plugin
File "calibre_plugins.deacsm.init", line 232, in initialize
deacsmprefs = prefs.DeACSM_Prefs()
AttributeError: module 'calibre_plugins.deacsm.prefs' has no attribute 'DeACSM_Prefs'
failed with traceback:
Traceback (most recent call last):
File "calibre/customize/ui.py", line 710, in initialize_plugin
File "calibre_plugins.deacsm.init", line 232, in initialize
deacsmprefs = prefs.DeACSM_Prefs()
AttributeError: module 'calibre_plugins.deacsm.prefs' has no attribute 'DeACSM_Prefs'

from acsm-calibre-plugin.

johunb avatar johunb commented on May 27, 2024

Thank you for your help!

from acsm-calibre-plugin.

twhitehead avatar twhitehead commented on May 27, 2024

Just a note that I worked around both it not being found and the version issue by editing the the libcrypto_ctypes.py file in the directory calibre had unpacked the plugin. Changed

if libcrypto_path is None:
    libcrypto_path = get_library('crypto', 'libcrypto.dylib', '42')
if not libcrypto_path:
    raise LibraryNotFoundError('The library libcrypto could not be found')

libcrypto = CDLL(libcrypto_path, use_errno=True)

to

#libcrypto_path = _backend_config().get('libcrypto_path')
#if libcrypto_path is None:
#    libcrypto_path = get_library('crypto', 'libcrypto.dylib', '42')
#if not libcrypto_path:
#    raise LibraryNotFoundError('The library libcrypto could not be found')

libcrypto = CDLL('libcrypto.so.3', use_errno=True)

as just regular loading locates this fine (memory says that I saw this was already loaded at runtime, but I am unable to duplicate that now, however, it still loads fine). And further down there was a

if not version_match:
    version_match = re.search('(?<=LibreSSL )(\\d\\.\\d(\\.\\d)?)\\b', version_string)
if not version_match:
    raise LibraryNotFoundError('Error detecting the version of libcrypto')

which obviously needs \\d+ if your crpyto version string has any components > 9 (i.e., more than one digit long). With those two changes it all just worked.

from acsm-calibre-plugin.

Leseratte10 avatar Leseratte10 commented on May 27, 2024

Interesting, thanks for that patch. I don't know that much about library loading so I can't comment on the 1st change too much (I will need to look into that), but the 2nd change is something that I did for Linux as well a while ago (after openssl 3.0.10 came out) so I'll add that patch for the Mac library as well.

from acsm-calibre-plugin.

twhitehead avatar twhitehead commented on May 27, 2024

No problem. I did it again just now and updated the comment to have the correct library loading line (libcrypto.so.3).

Had read through the code, and the commented code is ultimately using the ctypes library location function find_library. It is pretty over the top, invoking gcc to try and locate the library it links against when you do a -lcrypto. To quote the reference

On Linux, find_library() tries to run external programs (/sbin/ldconfig, gcc, objdump and ld) to find the library file. It returns the filename of the library file.

Anyway, figured it made much more sense to just try and load it and let the system do its standard library loading location searching. Only item is that you do need the major version number. Wouldn't be hard to loop down trying versions from 3, or even 4 or 5, though.

from acsm-calibre-plugin.

ToxicFrog avatar ToxicFrog commented on May 27, 2024

I ran into the same problem (also on nixos), and the fixed version from github actions has timed out and is no longer available even when logged in. So here was my quick and dirty approach to getting a working install:

  • clone the repo
  • edit bundle_calibre_plugin.sh and package_modules.sh to use #!/usr/bin/env bash rather than #!/bin/bash
  • comment out everything related to building keyextract, since I don't care about extracting existing keys from a windows machine or a wineprefix at present
  • run bundle_calibre_plugin.sh

This gets a working plugin zip, but it also needs a bit of fiddling to properly find libcrypto. nix-shell on its own isn't enough, because then whatever it does to hunt down the library finds libcrypto.so.50 but the actual call to dlopen() can't. So:

  • nix-shell -p libressl
  • env LD_LIBRARY_PATH="${NIX_LDFLAGS##* -L}" calibre

and now it works, and I've successfully activated it with an anonymous ADE account.

from acsm-calibre-plugin.

zoof avatar zoof commented on May 27, 2024

The link is working fine, but only for users logged in on Github - sadly Github doesn't allow making these links public.

The link is definitely dead now. New link?

from acsm-calibre-plugin.

Leseratte10 avatar Leseratte10 commented on May 27, 2024

I've updated the included oscrypto version again, maybe that already fixes some of the issues.

Before I add the CDLL code patch by @twhitehead (if it's still needed with the new version) I need to test that some more to make sure it doesn't break any OS and/or older Calibre versions.

In case the link expires again I've also attached the current build of the plugin (64aaca3) here: calibre-plugin.zip

from acsm-calibre-plugin.

zoof avatar zoof commented on May 27, 2024

Now working on Debian Bookworm.

from acsm-calibre-plugin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.