babluboy / bookworm

A simple ebook reader for Elementary OS
GNU General Public License v3.0
1.32k stars 100 forks source link

File name too long #59

Closed inputsh closed 7 years ago

inputsh commented 7 years ago

To test the application out, I've tried opening some epub book from my Calibre library.

Now, generously speaking, Calibre really does not give a shit about how long of a file name it stores. So, I've tried opening two books and got this as a terminal output:

[_LOG_LEVEL_WARN 11:04:40.757021] utils.vala:106: Error encountered in execution of sync command [cp "/tmp/bookworm/The Boy Who Could Change the World_ The Wr - Aaron Swartz.epub/OEBPS/Images/CoverAleksanda6822rTodorovicaleksandartodorovicmailr.jpg" "/home/r3bl/.config/bookworm/covers/_home_r3bl_Documents_calibre_AaronSwartz_TheBoyWhoCouldChangetheWorld_TheWritingsofAaronSwartz(90)_TheBoyWhoCouldChangetheWorld_TheWr-AaronSwartz.epub_CoverAleksanda6822rTodorovicaleksandartodorovicmailr.jpg"]: cp: failed to access '/home/r3bl/.config/bookworm/covers/_home_r3bl_Documents_calibre_AaronSwartz_TheBoyWhoCouldChangetheWorld_TheWritingsofAaronSwartz(90)_TheBoyWhoCouldChangetheWorld_TheWr-AaronSwartz.epub_CoverAleksanda6822rTodorovicaleksandartodorovicmailr.jpg': File name too long
[_LOG_LEVEL_WARN 11:04:40.757133] [GLib] Invalid file descriptor.
[_LOG_LEVEL_FATAL 11:04:40.757529] file /build/bookworm-phyDv0/bookworm-0.1/src/bookworm.vala: line 386: uncaught error: Failed to open file '/home/r3bl/.config/bookworm/covers/_home_r3bl_Documents_calibre_AaronSwartz_TheBoyWhoCouldChangetheWorld_TheWritingsofAaronSwartz(90)_TheBoyWhoCouldChangetheWorld_TheWr-AaronSwartz.epub_CoverAleksanda6822rTodorovicaleksandartodorovicmailr.jpg': File name too long (g-file-error-quark, 3)

Another attempt:

[_LOG_LEVEL_WARN 11:05:14.980668] utils.vala:106: Error encountered in execution of sync command [cp "/tmp/bookworm/Invent Your Own Computer Games With Python - Al Sweigart.epub/OEBPS/images/9781593277956.jpg" "/home/r3bl/.config/bookworm/covers/_home_r3bl_Documents_calibre_AlSweigart_InventYourOwnComputerGamesWithPython(152)_InventYourOwnComputerGamesWithPython-AlSweigart.epub_9781593277956.jpg"]: cp: failed to access '/home/r3bl/.config/bookworm/covers/_home_r3bl_Documents_calibre_AlSweigart_InventYourOwnComputerGamesWithPython(152)_InventYourOwnComputerGamesWithPython-AlSweigart.epub_9781593277956.jpg': File name too long
[_LOG_LEVEL_WARN 11:05:14.980801] [GLib] Invalid file descriptor.
[_LOG_LEVEL_FATAL 11:05:14.981016] file /build/bookworm-phyDv0/bookworm-0.1/src/bookworm.vala: line 386: uncaught error: Failed to open file '/home/r3bl/.config/bookworm/covers/_home_r3bl_Documents_calibre_AlSweigart_InventYourOwnComputerGamesWithPython(152)_InventYourOwnComputerGamesWithPython-AlSweigart.epub_9781593277956.jpg': File name too long (g-file-error-quark, 3)

I haven't received any graphical indication that something bad happened, I just got redirected back to the default library view and in both cases, the book wasn't added there.

System: Ubuntu GNOME 17.04 Method of installation: via PPA

So, is there some unavoidable file path length or can this be fixed to allow adding files with such a ridiculously long file paths that Calibre stores its books in?

babluboy commented 7 years ago

@aleksandar-todorovic Many thanks for raising this bug ...calling this a bug as Bookworm should be able to handle any file length...this specific issue is coming up as I'm caching the cover image of the book and appending the path to the book in front of the file name to avoid clashing of the file names of two books called cover.jpg... maybe instead of appending the path to the filename I can append the "id" of the book which is a unique number generated for each book added to the library, so should be good enough to avoid name clash... will issue a fix by tonight and update this bug to let you know...

inputsh commented 7 years ago

Awesome! Looking forward to seeing this fixed. Please, keep me updated and let me know if I can help you out in any way.

babluboy commented 7 years ago

Fixed the bug and did some initial testing to ensure that file names for the cover images are created with the book id to make them unique. Pushed the code into the daily PPA on Launchpad (ppa:bablu-boy/bookworm-daily) and to GitHub master as well...

Will be great if you are able to test and check if the bug is fixed and you are able to load the two books into Bookworm

inputsh commented 7 years ago

Unfortunately, no.

Added the new PPA, removed the old one, updated the app, tried opening the same books, and the output seems fairly identical to what I have posted in this issue, with the only exception being that this has been added as the fourth line:

[_LOG_LEVEL_FATAL 22:34:38.716632] Bookworm will not function properly.

Full output whenever I execute bookworm, maybe you can find something out of interest:

[_LOG_LEVEL_INFO 22:41:00.677222] Application.vala:153: Bookworm version: 0.5
[_LOG_LEVEL_INFO 22:41:00.677283] Application.vala:155: Kernel version: 4.10.0-20-generic

(bookworm:11996): Gtk-WARNING **: Theme parsing error: <data>:1:29: Using Pango syntax for the font: style property is deprecated; please use CSS syntax
[_LOG_LEVEL_WARN 22:41:00.757276] Utils.vala:222: Couldn't apply style to label: <data>:1:12not a number

(bookworm:11996): Gtk-WARNING **: Theme parsing error: <data>:1:30: Using Pango syntax for the font: style property is deprecated; please use CSS syntax
[_LOG_LEVEL_WARN 22:41:00.757357] Utils.vala:222: Couldn't apply style to label: <data>:1:12not a number
[_LOG_LEVEL_WARN 22:41:00.777862] [GLib] Invalid file descriptor.
[_LOG_LEVEL_WARN 22:41:00.777940] [GLib] Invalid file descriptor.
[_LOG_LEVEL_WARN 22:41:00.777996] [GLib] Invalid file descriptor.
[_LOG_LEVEL_FATAL 22:41:00.819793] file /build/bookworm-SAzTwJ/bookworm-0.1/src/library.vala: line 40: uncaught error: Failed to open file '/home/r3bl/.config/bookworm/covers/_home_r3bl_Documents_calibre_AaronSwartz_TheBoyWhoCouldChangetheWorld_TheWritingsofAaronSwartz(90)_TheBoyWhoCouldChangetheWorld_TheWr-AaronSwartz.epub_CoverAleksanda6822rTodorovicaleksandartodorovicmailr.jpg': File name too long (g-file-error-quark, 3)
[_LOG_LEVEL_FATAL 22:41:00.819815] Bookworm will not function properly.
[_LOG_LEVEL_FATAL 22:41:00.824151] file /build/bookworm-SAzTwJ/bookworm-0.1/src/library.vala: line 40: uncaught error: Failed to open file '/home/r3bl/.config/bookworm/covers/_home_r3bl_Documents_calibre_AlSweigart_InventYourOwnComputerGamesWithPython(152)_InventYourOwnComputerGamesWithPython-AlSweigart.epub_9781593277956.jpg': File name too long (g-file-error-quark, 3)
[_LOG_LEVEL_FATAL 22:41:00.824172] Bookworm will not function properly.
[_LOG_LEVEL_FATAL 22:41:00.828292] file /build/bookworm-SAzTwJ/bookworm-0.1/src/library.vala: line 40: uncaught error: Failed to open file '/home/r3bl/.config/bookworm/covers/_home_r3bl_Documents_calibre_AaronSwartz_TheBoyWhoCouldChangetheWorld_TheWritingsofAaronSwartz(90)_TheBoyWhoCouldChangetheWorld_TheWr-AaronSwartz.epub_CoverAleksanda6822rTodorovicaleksandartodorovicmailr.jpg': File name too long (g-file-error-quark, 3)
[_LOG_LEVEL_FATAL 22:41:00.828314] Bookworm will not function properly.
[_LOG_LEVEL_WARN 22:41:00.842511] [GLib-GObject] invalid cast from 'GtkEventBox' to 'GtkFlowBoxChild'
[_LOG_LEVEL_FATAL 22:41:00.849243] file /build/bookworm-SAzTwJ/bookworm-0.1/src/library.vala: line 40: uncaught error: Failed to open file '/home/r3bl/.config/bookworm/covers/_home_r3bl_Documents_calibre_AlSweigart_InventYourOwnComputerGamesWithPython(152)_InventYourOwnComputerGamesWithPython-AlSweigart.epub_9781593277956.jpg': File name too long (g-file-error-quark, 3)
[_LOG_LEVEL_FATAL 22:41:00.849280] Bookworm will not function properly.
[_LOG_LEVEL_FATAL 22:41:00.854449] file /build/bookworm-SAzTwJ/bookworm-0.1/src/library.vala: line 40: uncaught error: Failed to open file '/home/r3bl/.config/bookworm/covers/_home_r3bl_Documents_calibre_AaronSwartz_TheBoyWhoCouldChangetheWorld_TheWritingsofAaronSwartz(90)_TheBoyWhoCouldChangetheWorld_TheWr-AaronSwartz.epub_CoverAleksanda6822rTodorovicaleksandartodorovicmailr.jpg': File name too long (g-file-error-quark, 3)
[_LOG_LEVEL_FATAL 22:41:00.854484] Bookworm will not function properly.
babluboy commented 7 years ago

From the output above, it looks like you are still on the stable branch i.e. on v0.5. The latest code v0.6 with the fix is available on the daily PPA (ppa:bablu-boy/bookworm-daily). However Launchpad is only building the Zesty and Xenial packages...the latest package version should be "0.6-0~78"

If the daily PPA does not get you the latest version, then building from source is another alternative: sudo apt-get build-dep granite-demo sudo apt-get install libgranite-dev sudo apt-get install valac sudo apt-get install libwebkit2gtk-4.0-37 libwebkit2gtk-4.0-dev sudo apt-get install sqlite3 libsqlite3-dev sudo apt-get install poppler-utils libpoppler-glib-dev

git clone https://github.com/babluboy/bookworm.git cd bookworm mkdir build && cd build cmake -DCMAKE_INSTALL_PREFIX=/usr ../ make

I will check the PPA to see why the latest version is not installing. You can let me know if you are able to build from source and resolve the issue. All this will anyway be simpler when I push the latest branch of code into Appcenter

babluboy commented 7 years ago

I figured out the problem, it was due to the package name required by appcenter to be a fully qualified name - com.github.babluboy.bookworm instead of just bookworm.

I have updated the code in launchpad to put the package name as just bookworm and not the fully qualified name. You can try installing from the daily and get the current v0.6 version. That should have the fix to resolve the file name being too long issue. sudo add-apt-repository ppa:bablu-boy/bookworm-daily sudo apt-get update sudo apt install bookworm

I will also push the latest v0.6 into the stable package today. Please update back if you still see the issue in v0.6

inputsh commented 7 years ago

Confirmed.

The issue has been solved in the daily PPA.