Bug 340323 - Okular unable to open .cbr files due to inabillity to find unrar due to unrar having removed the --version flag in unrar 5.2.1
Summary: Okular unable to open .cbr files due to inabillity to find unrar due to unrar...
Status: RESOLVED FIXED
Alias: None
Product: okular
Classification: Applications
Component: Comicbook backend (show other bugs)
Version: 0.20.2
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: Okular developers
URL:
Keywords:
: 347634 (view as bug list)
Depends on:
Blocks:
 
Reported: 2014-10-24 23:53 UTC by Jörg Schuck
Modified: 2015-05-12 21:35 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In: 4.14.3


Attachments
Possible patch to fix the bug (614 bytes, patch)
2014-10-25 06:04 UTC, Yuri Chornoivan
Details
Patch with a fallback to -v on --version error. (1.14 KB, patch)
2014-10-25 15:21 UTC, Jörg Schuck
Details
My version of the patch (1.06 KB, patch)
2014-10-27 21:12 UTC, Albert Astals Cid
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jörg Schuck 2014-10-24 23:53:22 UTC
I tried to open a .cbr file today. Okular could not display it, claiming that it can't find unrar. Since i had similar problems last year i checked the package installation history and, yes i got an unrar update from 1:5.1.7-1 to version 1:5.2.1-1

To be sure i checked the okular source code to see how the detection worked and tried that manually. Results of that further below.

Reproducible: Always

Steps to Reproduce:
1. Install unrar verstion 1:5.2.1-1
2. Open .cbr file
3.Error

Actual Results:  
Empty file with error message displayed. Red error box in main okular window claims it couldn't find unrar.

Expected Results:  
Display of the comic book contents.

Since okular basically calls unrar --version to determine which unrar flavor is installed i tried

$ unrar --version

Which gave me this:
ERROR: Unknown option: -version

I noticed that it gave me only one - back so i tried:

$ unrar -v

Which gave me:
UNRAR 5.20 beta 1 freeware      Copyright (c) 1993-2014 Alexander Roshal

Downgrading unrar to 1:5.1.7-1 i tried it again, just to confirm:

$ unrar --version

The Result was:
UNRAR 5.11 beta 1 freeware      Copyright (c) 1993-2014 Alexander Roshal

So yeah, this unrar flavor only supports the short -v flag not the long --version flag in version 1:5.2.1-1.
Comment 1 Yuri Chornoivan 2014-10-25 06:04:10 UTC
Created attachment 89312 [details]
Possible patch to fix the bug

Can somebody test it (I have no cbr at hand)?
Comment 2 Jörg Schuck 2014-10-25 08:42:13 UTC
That patch compiles and works for me.
Comment 3 Luigi Toscano 2014-10-25 14:27:22 UTC
No, the patch breaks the detection of the unrar-free version, which only accepts --version (at least for 0.0.1+cvs20140707-1 which is in Debian.
Comment 4 Jörg Schuck 2014-10-25 15:21:51 UTC
Created attachment 89316 [details]
Patch with a fallback to -v on --version error.

This patch should be better then. It only falls back to -v if --version returns an the ERROR line.
It could use some refactoring though.
Comment 5 Albert Astals Cid 2014-10-27 21:12:49 UTC
Created attachment 89341 [details]
My version of the patch

Can you guys check if that works for you? I'd prefer it written like that if you can confirm it works
Comment 6 Jörg Schuck 2014-10-27 21:26:21 UTC
Compiles and works with unrar 1:5.2.1-1 and 1:5.1.7-1.
Comment 7 Albert Astals Cid 2014-10-27 21:36:20 UTC
Git commit 717c4b0f6a3a1bc8a2ac02a4028be62c4b4996e3 by Albert Astals Cid.
Committed on 27/10/2014 at 21:34.
Pushed by aacid into branch 'KDE/4.14'.

Fix unrar detection for versions that don't support --version

Based on patches by Yuri Chornoivan and Jörg Schuck
FIXED-IN: 4.14.3

M  +6    -3    generators/comicbook/unrar.cpp

http://commits.kde.org/okular/717c4b0f6a3a1bc8a2ac02a4028be62c4b4996e3
Comment 8 Albert Astals Cid 2015-05-12 21:35:53 UTC
*** Bug 347634 has been marked as a duplicate of this bug. ***