Bug 189194 - support any arbitrary archive format
Summary: support any arbitrary archive format
Status: RESOLVED INTENTIONAL
Alias: None
Product: okular
Classification: Applications
Component: Comicbook backend (show other bugs)
Version: unspecified
Platform: openSUSE Unspecified
: NOR wishlist
Target Milestone: ---
Assignee: Okular developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-04-09 11:18 UTC by Maciej Pilichowski
Modified: 2009-04-09 14:34 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Maciej Pilichowski 2009-04-09 11:18:34 UTC
Version:            (using KDE 4.2.1)
Installed from:    SuSE RPMs

Let's face it -- comic book format is just an archive, rar, zip, etc. so it would be useful that instead of supporting just a few common (popular) archive formats okular would support any popular archive formats, since the
popular comic book format
is not the same as
popular archive format

I have in mind tar.gz, tar.bz2.
Comment 1 Pino Toscano 2009-04-09 11:32:47 UTC
The only way to distinguish a comicbook from a normal archive is the extension: cbr, cbz, cb7, cba, etc.
I won't make Okular accept any archive, just because people fail in naming their files correctly.
Comment 2 Maciej Pilichowski 2009-04-09 11:41:54 UTC
I was not talking about autodetection like in Konqueror, but execution from command-line

okular file

And it is not about "incorrect" filename -- you can view content using Ark, you can unpack it and view using gwenview (hopefully without unpacking soon), it would be useful to run okular as well.

The less trouble user has using various programs the better.

Now
okular x.cbr
works

okular x.rar
does not work. The difference is artificially made -- this is the same file.
Comment 3 Pino Toscano 2009-04-09 11:51:56 UTC
(In reply to comment #2)
> okular x.rar
> does not work. The difference is artificially made -- this is the same file.

This is _exactly_ was I was taling about:
> The only way to distinguish a comicbook from a normal archive is the extension:
> cbr, cbz, cb7, cba, etc.

Technically, "x.rar" is not a comicbook, but just a rar file. What distinguishes a normal rar (or zip, etc) from a normal archive is just one, ie the extension. If the only detail needed for them is not applied, then it is producer's fault.
Comment 4 Maciej Pilichowski 2009-04-09 12:57:04 UTC
> Technically, "x.rar" is not a comicbook, but just a rar file. 

The same for .cbr -- it is just rar file.

> What 
> distinguishes a normal rar (or zip, etc) from a normal archive is
> just one, ie the extension. 

Yes, for automatic detection it can be a hint. But extension does not make a file.

touch x.rar

Is this rar archive file?

Filename it is decoration for humans. This works:
okular x.xxx

where content of x.xxx is pdf. 

I don't see any reason why comic book should be treated differently (worse) than pdf.
Comment 5 Maciej Pilichowski 2009-04-09 13:14:26 UTC
PS. This also works
okular x.rar

as long as x.rar is pdf file (content). So it is clear okular checks the content for pdf and ignores extension completely. The wish is to extent this useful behaviour to all accepted formats.

Btw. okular is not an exception, other programs also behave similarly, like acrobat reader, Gimp or Kate.
Comment 6 Pino Toscano 2009-04-09 13:28:38 UTC
(In reply to comment #4)
> > Technically, "x.rar" is not a comicbook, but just a rar file. 
> 
> The same for .cbr -- it is just rar file.

... but explicitly telling "i'm a comicbook document". And if it isn't, then it
is fault of whoever marked it that way.

Let's go on with a bit of theory now, as you seem to speculate too much.

The PDF file format (MIME type) has two way to be recognized: an extension (.pdf) and a "magic", ie a sequence of leading bytes (header) in the document itself. If you try to open a PDF document named foo.xxx, one of the two ways is missing (the extension), but most probably the other not (the magic).

In case of comicbook documents, we have the various "unique" cbr, cbz, cba, etc, extensions, but the magic is not unique, as it is the same of a zip, rar, etc. Thus, the *only* way to distinguish what you call "comicbook compressed as zip" from a normal zip archive is the extension.
Also see http://en.wikipedia.org/wiki/Comic_Book_Archive_file

> I don't see any reason why comic book should be treated differently (worse)
> than pdf.

As you can see, we're not treating comicbook worse, but just handling the only way we have to recognize them out of the wild, given also the fact there's nothing in the archive itself that can be used to indicate that.

> So it is clear okular checks the content for pdf and ignores extension completely.

Okular does not ignore the extension.

> The wish is to extent this useful behaviour to all accepted formats.

Ignoring the extension would mean making Okular's comicbook backend blindly accept _any_ archive, and I don't want people misusing Okular as a second Ark.
I wouldn't call it as "useful behaviour".

Thus, the wish is rejected.
Comment 7 Maciej Pilichowski 2009-04-09 14:15:44 UTC
> Ignoring the extension would mean making Okular's comicbook backend
> blindly accept _any_ archive, 

Because? What harm can be done with .rar that cannot be done with .cbr?
Comment 8 Pino Toscano 2009-04-09 14:22:00 UTC
(In reply to comment #7)
> > Ignoring the extension would mean making Okular's comicbook backend
> > blindly accept _any_ archive, 
> 
> Because? What harm can be done with .rar that cannot be done with .cbr?

> > and I don't want people misusing Okular as a second Ark.
Comment 9 Maciej Pilichowski 2009-04-09 14:34:15 UTC
> > > I don't want people misusing Okular as a second Ark.

Oh, so the harm would be that some users could read .rar file? 

Yes, this is a good reason, it could be harmful for users. I imagined improperly that users could simply manage the archive (add images) using ark, then check the effect using okular, then make some corrections (ark), and then check it again (okular), and so on.

It is way better to force user to rename the file at each step and avoid harm of reading .rar files directly. This way there is more emphasis on okular.

Thanks for clarification.