babluboy / bookworm

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

ePub mimetype file permission incorrect #254

Closed arooni closed 5 years ago

arooni commented 5 years ago

Hi.

Love this app.

Recently I started syncing all the books I'm actively reading via syncthing, which is kinda like an open sourced dropbox clone.

Anyway it auto populated books into the monitored bookworm library folder but they don't seem to appear in the library. Any ideas what I can do ? All books that were there previously are available, it just seems new ones are not.

babluboy commented 5 years ago

@arooni Thanks for your time I’m raising this issue. Is this a permission issue. So you see all the ebook files in the Bookworm monitored folder and they don’t appear in the Bookworm library? Hope you have set the monitored folder in Bookworm Preferences: Enable Book Discovery

  1. Two ways to debug: Try adding one or two books manually from the monitored folder and see if it works.

  2. Run Bookworm in discovery mode in terminal and put the output here. The command to run is: com.github.babluboy.bookworm --discover > ~/bookworm_debug.txt Then attach the bookworm_debug.txt in the home folder to this issue so that I can take a look if it is tripping up somewhere while trying to add books from the watched folder.

arooni commented 5 years ago

it does appear to be a permissions issue see below. But also I have specified the monitored folder within bookworm and it doesn't seem to be picking up the books.

(com.github.babluboy.bookworm:8327): GLib-WARNING **: 17:34:15.610: Invalid file descriptor.

(com.github.babluboy.bookworm:8327): WARNING : 17:34:15.670: utils.vala:462: Failure in File Operation [operation=READ,path=/home/david/.config/bookworm/books/Jesus Calling 50 Devotions for Comfort - Sarah Young.epub, filename=mimetype]: Failed to open file ?/home/david/.config/bookworm/books/Jesus Calling 50 Devotions for Comfort - Sarah Young.epub/mimetype?: Permission denied

(com.github.babluboy.bookworm:8327): WARNING : 17:34:15.752: utils.vala:462: Failure in File Operation [operation=READ,path=/home/david/.config/bookworm/books/Jesus Calling 50 Devotions for Comfort - Sarah Young.epub, filename=mimetype]: Failed to open file ?/home/david/.config/bookworm/books/Jesus Calling 50 Devotions for Comfort - Sarah Young.epub/mimetype?: Permission denied

(com.github.babluboy.bookworm:8327): GLib-WARNING **: 17:34:15.763: Invalid file descriptor.

but not sure why, I have access to all the files. and what's also interesting is that the real files are at /home/david/syncthing/ebooks ;; not where it's trying to read it from.

babluboy commented 5 years ago

Thanks for the details. I think this is similar to #182 where the mimetype file has got elevated permissions which does not allow bookworm to open this file and check its content during the validation check.

The files are being read from /home/david/.config/bookworm/books/ as that is where bookworm will extract the epub contents when the preference option is set for caching the ebook contents (otherwise everytime the /tmp folder will be used)

You can check the /home/david/.config/bookworm/books/Jesus Calling 50 Devotions for Comfort - Sarah Young.epub/mimetype file and give it read permissions if it dosent have read permissions for your user-id

babluboy commented 5 years ago

A probable solution is to throw up a pop up for sudo and get the permission changed for such files during extraction, so that there will not be an issue when bookworm attempts to read the files subsequently.

A work around is to unzip the epub, set the right permissions and zip it back up again as mentioned in this issue