Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Fri 23 Aug 2019, 14:34
All times are UTC - 4
 Forum index » House Training » Bugs ( Submit bugs )
Incompatibility btw. ROX on Puppy and Calibre 3.39.1 ?
Moderators: Flash, Ian, JohnMurga
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 3 [36 Posts]   Goto page: 1, 2, 3 Next
Author Message
clerk_gabel

Joined: 29 Aug 2018
Posts: 24
Location: norway

PostPosted: Mon 11 Feb 2019, 11:12    Post subject:  Incompatibility btw. ROX on Puppy and Calibre 3.39.1 ?
Subject description: Slacko 6.3.2
 

Using Slacko 6.3.2 with ROX and Calibre 3.39.1 calls for external viewers for pdf, docx. doc etc. from within Calibre (otherwise working fine) is aborted, where errors like this are returned in a termina vindow
Code:
 <?xml version="1.0"?>
<env:Envelope xmlns:env="http://www.w3.org/2001/12/soap-envelope"><env:Body xmlns:rox="http://rox.sourceforge.net/SOAP/ROX-Filer"><env:Fault xmlns:rpc="http://www.w3.org/2001/12/soap-rpc" xmlns:env="http://www.w3.org/2001/12/soap-envelope"><faultcode>Failed</faultcode><faultstring>'/mnt/sda3/calibre-bibliotek/Ukendt/Darstellung%20der%20Aufnahme%20der%20ersten%20Juden%20in%20Hamburg%20(177)/Darstellung%20der%20Aufnahme%20der%20ersten%20Juden%20-%20Ukendt.doc' is not a valid URI</faultstring></env:Fault></env:Body></env:Envelope>

As Calibres internal viewer works fine for .epup but lags when opening .pdf I reported this bug / incompatibility with Rox to Calibre and received within an hour feed-back from the main developer Kovid Goyal who wrote:
"calibre uses Qt's openExternalUrl() function which IIRC on linux uses the xdg-open shell script. If it is not working, xdg-open on your system is broken, fix it and you will be fine."

the xdg-open on Slacko 6.3.2 is:
Code:
   #!/bin/sh
#this script created by Jemimah. see: http://murga-linux.com/puppy/viewtopic.php?t=63400&start=150
#110115 xdg-open used to be a symlink to defaulthandler.
#!/bin/bash
case "$1" in
        '') exit
                ;;
        *://*) exec rox -U "$1"
                ;;
        *@*.*) exec rox -U "mailto:${1}"
                ;;
        *) exec rox "$1"
                ;;
esac

I have tried deleting xdg-open and instead setting it as symlink from defaulthandler to no avail - any suggestions / comments /ideas for a workaround?
Back to top
View user's profile Send private message 
williams2

Joined: 14 Dec 2018
Posts: 124

PostPosted: Mon 11 Feb 2019, 20:12    Post subject:  

Calibre is replacing all spaces in the filename with %20.

a quick workaround could be to replace:

Code:
*) exec rox "$1"


with:

Code:
exec rox "$(echo "$1"|sed "s/%20/ /g")"


in the file xdg-open. This might affect other programs that use xdg-open. Or not.

By the way, there is a bug in bionicpup64-7.9.7 xdg-open. The magnet line will never execute:

Code:
*) exec rox "$1"
    ;;
magnet:*) exec transmission "$1"


because *) exec rox "$1" will execute first and never return.
Back to top
View user's profile Send private message 
disciple

Joined: 20 May 2006
Posts: 6956
Location: Auckland, New Zealand

PostPosted: Mon 11 Feb 2019, 21:09    Post subject:  

Quote:
calibre uses Qt's openExternalUrl() function which IIRC on linux uses the xdg-open shell script. If it is not working, xdg-open on your system is broken, fix it and you will be fine."

Puppy's xdg-open is different from the "standard" xdg-open found in most distros, so maybe that one would do things differently and work.
But it does look like Calibre is providing a mashup between a file path and a URI. Like Williams2 said, a file path shouldn't use %20. A URI should use the %20, but it should also be prefixed with file://
I suspect other more common filers (or whatever the standard xdg-open sends file paths to) are able to cope with a bastardised path/URI, but Rox simply isn't that tolerant.

_________________
Do you know a good gtkdialog program? Please post a link here

Classic Puppy quotes

ROOT FOREVER
GTK2 FOREVER
Back to top
View user's profile Send private message 
oldaolgeezer

Joined: 03 Dec 2006
Posts: 56

PostPosted: Mon 11 Feb 2019, 21:45    Post subject: ROX and Calibre 3.39.1 external viewers for pdf, doc
Subject description: a possible work-a-round
 

I have an older calibre 3.33.1 on my xenialpup 7.5 - 32 bit, but:

I assume that you have pdf, docx. doc files already dragged into calibre
and you are clicking on the "Formats" line on the right side of the calibre screen after selecting one of the non ebook files mentioned above.

locating xdg-open:

find / -name *xdg-open* -print
/usr/bin/xdg-open <=== this is just a symbolic link to the file in the next line
/usr/local/bin/xdg-open

In DpupStretch: /usr/local/bin/xdg-open is:

case "$1" in
'') exit ;;
*://*) exec defaultbrowser "$1" ;;
*@*.*) exec rox -U "mailto:${1}" ;;
*) exec defaultfilemanager "$1" ;;
esac
===

the xdg-open on Slacko 6.3.2 (with no "magnet" line)
and xenialpup 7.5 - 32 bit: /usr/local/bin/xdg-open is:

#!/bin/bash
case "$1" in
'') exit
;;
*://*) exec rox -U "$1"
;;
*@*.*) exec rox -U "mailto:${1}"
;;
*) exec rox "$1"
;;
magnet:*) exec transmission "$1"
;;
esac

===

If you follow the case..esac settings:

Something with "//" in it is launched as an URL
Something with "@" in it is launched as an e-mail address
Anything else ("*") is processed through ROX's regular MIME
file-type database.

===

after saving a copy of /usr/local/bin/xdg-open, add one line
*://*) exec defaultbrowser "$1" ;;
to the file: /usr/local/bin/xdg-open
before the *://*) exec rox -U "$1" line so that the lines look like this:

case "$1" in
'') exit
;;
*://*) exec defaultbrowser "$1" ;;
*://*) exec rox -U "$1"
;;
*@*.*) exec rox -U "mailto:${1}"
;;
*) exec rox "$1"
;;
esac

===

This lets the "defaultbrowser" handle those non ebook calibre "files".

On my laptop, telling calibre to open a previously given to calibre .doc or .pdf file, my default browser, palemoon, displays a little window offering a choice of saving the file (which calibre already has a copy) but also offers to execute the defaultwordprocessor (for a .doc file) or qpdfview (for a .pdf file.)
Back to top
View user's profile Send private message 
williams2

Joined: 14 Dec 2018
Posts: 124

PostPosted: Mon 11 Feb 2019, 22:54    Post subject:  

a file could have the characters %20 in the name. This might work better. Replace:

Code:
*) exec rox "$1"


with:

Code:
test -f "$1" && exec rox "$1"
exec rox "$(echo "$1"|sed "s/%20/ /g")"


If the file exists, it opens it with rox (which does the same thing that clicking the file would do.) If the file does not exist, it then tries changing %20s to spaces.

oldaolgeezer, the filename Calibre supplied does not seem to have the characters "://" in it, so I don't think this should work.

Code:
*://*) exec defaultbrowser "$1" ;;


I think this should work - replace:

Code:
*) exec rox "$1"
  ;;


with:

Code:
test -f "$1" && exec rox "$1"
exec defaultbrowser "$1"
  ;;
Back to top
View user's profile Send private message 
oldaolgeezer

Joined: 03 Dec 2006
Posts: 56

PostPosted: Tue 12 Feb 2019, 13:02    Post subject: Incompatibility btw. ROX on Puppy and Calibre 3.39.1
Subject description: a little more testing of test pdf and doc files in calibre
 

I did a little more testing, by dragging and dropping a test pdf and doc file
onto my calibre's desktop icon.

On my slacko-6.3.2-uefi, with the *://*) exec defaultbrowser "$1" ;; line
addition to /usr/local/bin/xdg-open, telling calibre to open the calibre
file called: "IRS f1040", the defaultbrowser, firefox,
was passed the string:

file:///mnt/home/Documents%20and%20Settings/Owner/Calbre_Library/SE_W_CAR_MP/2018%20Form%201040%20%28356%29/2018%20Form%201040%20-%20SE_W_CAR_MP.pdf

and firefox displayed the IRS form (with a space in its name.)

telling calibre to open the calibre file called: "Calibre test of doc file in Puppy slacko-6.3.2-uefi.doc", the defaultwordprocessor, abiword,
was passed the string:
file:///mnt/home/Documents%20and%20Settings/Owner/Calbre_Library/Unknown/Calibre%20test%20of%20doc%20file%20in%20Puppy%20slacko-6.3.2-uefi%20(357)/Calibre%20test%20of%20doc%20file%20in%20Puppy%20slacko-6%20-%20Unknown.doc
and abiword displays the Microsoft doc file (with spaces in its name.)

(I believe the word "Unknown" within the string was because calibre had no author's name.)

Notice that both strings start with "file:///" so that someone smarter than me
could craft a better fix to /usr/local/bin/xdg-open.

I had left myself a note, that in my slacko-6.3.2-uefi, when my calibre was first installed,
I also needed and wanted the "fix" described here: "Open the browser from Calibre's ebook-viewer application"
(otherwise you can not get high lighting and then right clicking for calibre's
dictionary and search to work within calibre's ebook-viewer application):
http://www.murga-linux.com/puppy/viewtopic.php?t=112879
Screenshot of Calibre test of doc file.png
Description 
png

 Download 
Filename  Screenshot of Calibre test of doc file.png 
Filesize  32.53 KB 
Downloaded  98 Time(s) 
Back to top
View user's profile Send private message 
disciple

Joined: 20 May 2006
Posts: 6956
Location: Auckland, New Zealand

PostPosted: Tue 12 Feb 2019, 14:07    Post subject:  

How do you know Firefox is receiving a file:// and not adding it itself?
_________________
Do you know a good gtkdialog program? Please post a link here

Classic Puppy quotes

ROOT FOREVER
GTK2 FOREVER
Back to top
View user's profile Send private message 
williams2

Joined: 14 Dec 2018
Posts: 124

PostPosted: Tue 12 Feb 2019, 15:07    Post subject:  

The first thing I thought of was to put a line in xdg-open to show exactly what was being passed to xdg-open, like
Code:
echo "$@" >> /tmp/xdg-open.log

but the rox error message in the first post showed the file name, without file://. But it MUST have :// in the name for oldaolgeezer's method to work. If I type
Code:
rox -U file:///tmp/xerrs.log

the rox error message says
<faultstring>'/tmp/xerrs.log' is not a valid URI
even though file:// was part of the filename.

So Calibre must be passing a filename with file://, which is almost certainly a valid URI. The browser can handle the URI properly, but rox does not. It might be possible to fix the way rox handles the file:// protocol using xdg-mime and update-mime-database which configure the files in, I think, /usr/share/mime/.
Back to top
View user's profile Send private message 
disciple

Joined: 20 May 2006
Posts: 6956
Location: Auckland, New Zealand

PostPosted: Tue 12 Feb 2019, 15:13    Post subject:  

Ok yes, you guys are dealing with a broken Puppy or puppies. That works perfectly in the version of Slacko I have here.
_________________
Do you know a good gtkdialog program? Please post a link here

Classic Puppy quotes

ROOT FOREVER
GTK2 FOREVER
Back to top
View user's profile Send private message 
williams2

Joined: 14 Dec 2018
Posts: 124

PostPosted: Tue 12 Feb 2019, 15:43    Post subject:  

The symlink /etc/xdg/rox.sourceforge.net/URI/file doesn't seem to work. Don't know why, but it should be easy to fix. Maybe something in /etc/xdg/rox.sourceforge.net/MIME-types/.
Back to top
View user's profile Send private message 
oldaolgeezer

Joined: 03 Dec 2006
Posts: 56

PostPosted: Tue 12 Feb 2019, 16:44    Post subject: Incompatibility btw. ROX on Puppy and Calibre 3.39.1
Subject description: a little more testing
 

Hi williams2

The symlink supplies a missing "https" in /root/Choices/URI (not in /etc) in some puppy iso's
(the older one for just "http" has been in puppy for a long time):

ln -s /usr/local/bin/defaultbrowser /root/Choices/URI/https

Re: How do you know Firefox is receiving a file:// and not adding it itself?

You ask a good question, and I know very little about the workings of calibre and xdg-open.

But, I tried another simple test: I added yet another addition line in front of the new line
I previously suggested, so that my slacko-6.3.2-uefi /usr/local/bin/xdg-open looks like this:

case "$1" in
'') exit
;;
*://*) exec echo "$1" > /tmp/xyz ;;
*://*) exec defaultbrowser "$1" ;;
*://*) exec rox -U "$1"
;;
*@*.*) exec rox -U "mailto:${1}"
;;
*) exec rox "$1"
;;
esac

then I told calibre to open the calibre file called: "Calibre test of doc file in Puppy slacko-6.3.2-uefi.doc" and in /tmp/xyz there is this string:
file:///mnt/home/Documents%20and%20Settings/Owner/Calbre_Library/Unknown/Calibre%20test%20of%20doc%20file%20in%20Puppy%20slacko-6.3.2-uefi%20(357)/Calibre%20test%20of%20doc%20file%20in%20Puppy%20slacko-6%20-%20Unknown.doc

notice the word "file" colon followed by three slashes (more than just the colon and two slashes which were previously tested for.

For a second test, when I selected an ebook in calibre, and opened it (this executes the calibre ebook-viewer application
in a new window and then highlighted the word "Civilization" in that ebook,
and right clicked on search, the file: /tmp/xyz contained the string:
https://www.google.com/search?q=Civilization

notice the word "https" colon followed by two slashes (this is meant for a browser not ROX's MIME-Type file handling.)

(for these tests, I kept adding an additional line in /usr/local/bin/xdg-open
so it is easy for me to modify or remove the line(s) after the test.)

We have to remember to restore our /usr/local/bin/xdg-open after all these tests !
Back to top
View user's profile Send private message 
williams2

Joined: 14 Dec 2018
Posts: 124

PostPosted: Tue 12 Feb 2019, 18:13    Post subject:  

The OP asked for a workaround. I think the attached file (gzipped, after downloading just click it to upzip it) should workaround your problem with Calbre. If it looks mostly like your xdg-open file, you can copy it to the right place in /usr/local/bin/. It's a good idea to backup the original file.

It might be a configuration problem, or it might be in the Rox source.

This is most of the file:
Code:
#!/bin/bash
case "$1" in
        '') exit
                ;;
        file://*) exec defaultbrowser "$1"
                ;;
        magnet:*) exec transmission "$1"
                ;;
        *://*) exec rox -U "$1"
                ;;
        *@*.*) exec rox -U "mailto:${1}"
                ;;
        *) exec rox "$1"
                ;;
esac


It should open the file with the default browser, which can deal with URIs.

I'm running bionicpup64-7.9.7 (I know, not the latest version.)
xdg-open.gz
Description 
gz

 Download 
Filename  xdg-open.gz 
Filesize  278 Bytes 
Downloaded  93 Time(s) 
Back to top
View user's profile Send private message 
williams2

Joined: 14 Dec 2018
Posts: 124

PostPosted: Tue 12 Feb 2019, 18:29    Post subject:  

oldaolgeezer, thanks for your help.

My Puppy has https in /etc/xdg/rox.sourceforge.net/URI/. So this works:

rox -U https://www.goggle.com

but file:// doesn't work.

file:// is the protocol, /root/readme is a filename, so the URI would be:
file:///root/readme
which is why there are 3 /s. I think it needs to be an absolute path.
Back to top
View user's profile Send private message 
clerk_gabel

Joined: 29 Aug 2018
Posts: 24
Location: norway

PostPosted: Tue 12 Feb 2019, 18:42    Post subject:  

Thank you for replies. I have tested the suggestions except the by williams2 attached file (running out of time for today)
The "bug" is very minor as the Calibre add-on (Open With) will compensate, but doubleclicking on a thumb and seeing the MIME linked viewer pop up on top is nice.
If replacing in Slackos default xdg-open:
Code:
*) exec rox "$1"
with
exec rox "$(echo "$1"|sed "s/%20/ /g")"

the terminal returns
Code:
# calibre
/usr/local/bin/xdg-open: line 14: syntax error near unexpected token `rox'
/usr/local/bin/xdg-open: line 14: `exec rox "$(echo "$1"|sed "s/%20/ /g")"'
#

If using the whole dpupstretch xdg-open
Code:
case "$1" in
'') exit ;;
*://*) exec defaultbrowser "$1" ;;
*@*.*) exec rox -U "mailto:${1}" ;;
*) exec defaultfilemanager "$1" ;;
esac

a Palemoon dialog box saying "You have chosen to open ...pdf" with options for picking an application or saving in a directory.
Canceling the dialog box returns
Code:
# calibre
GLib-GIO-Message: Using the 'memory' GSettings backend.  Your settings will not be saved or shared with other applications.
#

and clicking on OK without navigating to a specific application results in Evince displaying the pdf.
After closing Evince -> Palemoon -> Calibre the console messages was:
Code:
# calibre
GLib-GIO-Message: Using the 'memory' GSettings backend.  Your settings will not be saved or shared with other applications.
GLib-GIO-Message: Using the 'memory' GSettings backend.  Your settings will not be saved or shared with other applications.
(evince:19492): GLib-GObject-WARNING **: gsignal.c:2593: instance `0x894c098' has no handler with id `1001'
(evince:19492): GLib-GObject-WARNING **: gsignal.c:2593: instance `0x894c098' has no handler with id `1002'
#

Doc documents called my word processor as an unregistered application (demanding a serial) and txt files wad displayed in Palemoon.

If using the "magnet" xdg-open
Code:
case "$1" in
'') exit
;;
*://*) exec rox -U "$1"
;;
*@*.*) exec rox -U "mailto:${1}"
;;
*) exec rox "$1"
;;
magnet:*) exec transmission "$1"
;;
esac

the primary error was returned in the terminal, and if when using
Code:
case "$1" in
'') exit
;;
*://*) exec defaultbrowser "$1" ;;
*://*) exec rox -U "$1"
;;
*@*.*) exec rox -U "mailto:${1}"
;;
*) exec rox "$1"
;;
esac

behavior similar to dpupstretch with Palemoon dialog happend, with console output also very similar:
Code:
# calibre                                                                 
GLib-GIO-Message: Using the 'memory' GSettings backend.  Your settings will not be saved or shared with other applications.
(evince:9177): GLib-GObject-WARNING **: gsignal.c:2593: instance `0x8810098' has no handler with id `1001'
(evince:9177): GLib-GObject-WARNING **: gsignal.c:2593: instance `0x8810098' has no handler with id `1002'
#


Thank you for efforts.Williams2, it looks as if you are a long way in programming a new Calibre add-on where the Open With addon already exist (integrates in the right click menu and can be included in the toolbar). I will test the attached file when I am not so occupied.
Back to top
View user's profile Send private message 
williams2

Joined: 14 Dec 2018
Posts: 124

PostPosted: Tue 12 Feb 2019, 20:22    Post subject:  

It says in xdg-open:
Quote:
xdg-open used to be a symlink to defaulthandler

This:
Code:
file://*) exec defaultbrowser "$1"

could be replaced with this:
Code:
file://*) exec defaulthandler "$1"

Geany can use URIs, also libreoffice. qpdfview does not work with URIs.

clerk_gabel, yes it's a very minor bug. The sed line will definitely not work, it assumed there was not a first:// prefix.

All I have done is to put 1 line in xdg-open to workaround the problem so that Puppy will work the way it did before this (minor) bug.
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 3 [36 Posts]   Goto page: 1, 2, 3 Next
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » House Training » Bugs ( Submit bugs )
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.1098s ][ Queries: 13 (0.0087s) ][ GZIP on ]