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

calibre: fix html5lib error #27290

Merged
merged 1 commit into from Jul 17, 2017
Merged

Conversation

calvertvl
Copy link
Contributor

@calvertvl calvertvl commented Jul 10, 2017

Motivation for this change

Commit ff5423c broke calibre with stacktraces like this one for ebook-edit. The main executable help page does work, but doesn't show this error until you actually try to start the GUI.

It took a number of attempts to identify the cause: basically, the newer html5lib associated with mechanize is found first, rather than the bundled one, and having the old html5lib in the prior location (late in the buildInputs list) causes the same behavior.

Putting the legacy version first in the python package list resolved the issue.

Things done
  • Tested using sandboxing
    (nix.useSandbox on NixOS,
    or option build-use-sandbox in nix.conf
    on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • Linux
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

Edited for commit hash.

@FRidh
Copy link
Member

FRidh commented Jul 11, 2017

When does calibre use mechanize? Because then it will use the wrong version of html5lib.

@calvertvl
Copy link
Contributor Author

@FRidh, I'm not sure where else, but the command in question is calibredb; there is a way to pass it a URL, so as long as you have calibre running with the server enabled (or run the standalone server), then this one will show all book titles in the library matching the search (in this case, any works by Arthur Conan Doyle is used as the exemplar).

calibredb \
    --with-library="http://localhost:8080/#Calibre_Library" \
    list \
    -f title \
    -sort_by=title \
    -s 'authors:"=Arthur Conan Doyle"'

This does assume that your library uses the default name of Calibre Library; there are instructions for how to use calibredb to get a list of libraries on the server which IIRC should also trigger the bug.

I discovered yesterday that my computer's case fans are dead, so it overheats if I do any long compilation, so e.g. building chromium causes it to lock up or power off. As such, I hadn't gotten this into actual use to see if this is an issue in practice; I was just able to verify that the base commands would handle <cmd> --help as they have in the past. I'll run the above test once I have the system fully working, and will see if I can figure out another way around this, but we may have to override mechanize just for calibre (to not propagate html5lib).

@calvertvl
Copy link
Contributor Author

Running a full test of my use case (as described above) with the changes in this branch does work.

My guess is that when calibre uses html5lib directly, it depends on html5lib_0_9999999, while other code uses mechanize instead, which acts as a wrapper around the newer html5lib (thus not exposing the new html5lib to most of calibre).

Perhaps someone more familiar with python packaging in nix can explain why this works, but including the older html5lib after mechanize in the buildInputs list or using the vendored version does not?

@FRidh
Copy link
Member

FRidh commented Jul 17, 2017

My guess is that when calibre uses html5lib directly, it depends on html5lib_0_9999999, while other code uses mechanize instead, which acts as a wrapper around the newer html5lib (thus not exposing the new html5lib to most of calibre).

I doubt it picks the correct version depending on what code is used. Instead, I think the parts of mechanize that are used work fine with another version of html5lib.

I'll merge this but its very fragile. Unfortunately I don't see any other solution either.

@FRidh FRidh merged commit 42cdad0 into NixOS:master Jul 17, 2017
@calvertvl calvertvl deleted the fix_calibre_html5lib branch July 19, 2017 18:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants