After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 619248 - Can't open cbz file with [] in archive
Can't open cbz file with [] in archive
Status: RESOLVED FIXED
Product: evince
Classification: Core
Component: backends
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Evince Maintainers
Evince Maintainers
Depends on:
Blocks:
 
 
Reported: 2010-05-20 23:53 UTC by Bastien Nocera
Modified: 2010-06-24 08:40 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
[comics] Adds comics_regex_quote(). Fixes bgo #619248 (6.68 KB, patch)
2010-06-05 09:59 UTC, Juanjo Marín
none Details | Review
[comics] Adds comics_regex_quote(). Fixes bgo #619248 (6.97 KB, patch)
2010-06-05 13:37 UTC, Juanjo Marín
none Details | Review
g_shell_quote() for zipnote (1.12 KB, patch)
2010-06-23 20:04 UTC, Juanjo Marín
none Details | Review

Description Bastien Nocera 2010-05-20 23:53:03 UTC
evince-2.30.1-2.fc13.x86_64

This archive doesn't work:
$ unzip -l '/home/hadess/Desktop/[foobar].cbz' 
Archive:  /home/hadess/Desktop/[foobar].cbz
  Length      Date    Time    Name
---------  ---------- -----   ----
        0  05-20-2010 02:15   [foobar]/
   232873  10-03-2004 17:58   [foobar]/15.jpg
   216998  10-03-2004 17:53   [foobar]/11.jpg
   226956  10-03-2004 18:04   [foobar]/20.jpg
   230478  10-03-2004 18:14   [foobar]/26.jpg
   211055  10-03-2004 17:51   [foobar]/09.jpg
   246621  10-03-2004 18:03   [foobar]/19.jpg
    83295  10-03-2004 18:17   [foobar]/29.jpg
   237913  10-03-2004 17:50   [foobar]/08.jpg
   245278  10-03-2004 18:10   [foobar]/24.jpg
   183933  10-03-2004 17:54   [foobar]/12.jpg
    79784  10-03-2004 17:46   [foobar]/00.jpg
   227710  10-03-2004 17:48   [foobar]/06.jpg
   225648  10-03-2004 17:56   [foobar]/14.jpg
   237923  10-03-2004 18:07   [foobar]/22.jpg
   225675  10-03-2004 18:15   [foobar]/27.jpg
   250446  10-03-2004 18:06   [foobar]/21.jpg
   225668  10-03-2004 18:01   [foobar]/17.jpg
   225102  10-03-2004 17:49   [foobar]/07.jpg
   215802  10-03-2004 18:12   [foobar]/25.jpg
   225538  10-03-2004 17:52   [foobar]/10.jpg
   219716  10-03-2004 17:47   [foobar]/05.jpg
   225585  10-03-2004 17:59   [foobar]/16.jpg
   219107  10-03-2004 17:55   [foobar]/13.jpg
   193983  10-03-2004 18:16   [foobar]/28.jpg
   239899  10-03-2004 18:02   [foobar]/18.jpg
   177005  10-03-2004 18:08   [foobar]/23.jpg
---------                     -------
  5529991                     27 files

This one does:

$ unzip -l '/home/hadess/Desktop/foobar].cbz' 
Archive:  /home/hadess/Desktop/foobar].cbz
  Length      Date    Time    Name
---------  ---------- -----   ----
        0  05-20-2010 02:15   foobar]/
   232873  10-03-2004 17:58   foobar]/15.jpg
   216998  10-03-2004 17:53   foobar]/11.jpg
   226956  10-03-2004 18:04   foobar]/20.jpg
   230478  10-03-2004 18:14   foobar]/26.jpg
   211055  10-03-2004 17:51   foobar]/09.jpg
   246621  10-03-2004 18:03   foobar]/19.jpg
    83295  10-03-2004 18:17   foobar]/29.jpg
   237913  10-03-2004 17:50   foobar]/08.jpg
   245278  10-03-2004 18:10   foobar]/24.jpg
   183933  10-03-2004 17:54   foobar]/12.jpg
    79784  10-03-2004 17:46   foobar]/00.jpg
   227710  10-03-2004 17:48   foobar]/06.jpg
   225648  10-03-2004 17:56   foobar]/14.jpg
   237923  10-03-2004 18:07   foobar]/22.jpg
   225675  10-03-2004 18:15   foobar]/27.jpg
   250446  10-03-2004 18:06   foobar]/21.jpg
   225668  10-03-2004 18:01   foobar]/17.jpg
   225102  10-03-2004 17:49   foobar]/07.jpg
   215802  10-03-2004 18:12   foobar]/25.jpg
   225538  10-03-2004 17:52   foobar]/10.jpg
   219716  10-03-2004 17:47   foobar]/05.jpg
   225585  10-03-2004 17:59   foobar]/16.jpg
   219107  10-03-2004 17:55   foobar]/13.jpg
   193983  10-03-2004 18:16   foobar]/28.jpg
   239899  10-03-2004 18:02   foobar]/18.jpg
   177005  10-03-2004 18:08   foobar]/23.jpg
---------                     -------
  5529991                     27 files

My guess is a problem opening the zip file with the brackets not being escaped.
Comment 1 Juanjo Marín 2010-05-22 08:01:31 UTC
hadess, thanks for reporting :)

AFAIK, it's a unzip bug. Unzip has three wildcard expressions:

*      matches a sequence of 0 or more characters
 ?     matches exactly 1 character
[...]  matches  any  single  character  found inside the brackets; ranges are
       specified by a beginning character, a hyphen, and an ending character.
       If  an  exclamation  point  or  a  caret (`!' or `^') follows the left
       bracket, then the range is  complemented.

If  no matches are found, the specification is assumed to be a literal filename.

Evince uses the following command for decompressing the pages:

unzip -p -C -- '/path/file.cbz' 'path/page.jpg'

we have the problem only with the page component and it only happens if 
the page component has the character '['

About the workaround, I can escape  '[' with '\[', but I've realised that if 
you 
use '`' for quotation instead of ''', provided by g_shell_quoation() unzip

unzip '/home/jjmarin/Desktop/[foobar.cbz' '\[foobar/1.jpg'
unzip '/home/jjmarin/Desktop/[foobar.cbz' `[foobar/1.jpg`

The second one is the most generic solution and requires less computing.
Comment 2 Juanjo Marín 2010-05-22 08:12:15 UTC
Well, what just after writing the comment I've realised it's not complete true. 
I will write a better analysis later on
Comment 3 Juanjo Marín 2010-06-05 09:50:44 UTC
Hi, I come up with a fix for the regex problem with unzip. Unzip accepts regex 
expressions for both the zip file and for the files compressed in the file.

Another related issue is that unzip -Z -l , used for listing the files included 
on the cbz file, doesn't handle encoding filenames properly and it turns 
unhandled characters into '??', that is a regex expression. I found out we can 
use zipnote to get the list of files correctly encoded, or at least I haven't 
found any problem so far.

So, listing the files with zipnote I can disable all the regex expression 
accepted by unzip (*,? and []). The funny thing is that I use the regex 
expression [] for disabling :)
Comment 4 Juanjo Marín 2010-06-05 09:59:11 UTC
Created attachment 162792 [details] [review]
[comics] Adds comics_regex_quote(). Fixes bgo #619248
Comment 5 Juanjo Marín 2010-06-05 13:37:49 UTC
Created attachment 162805 [details] [review]
[comics] Adds comics_regex_quote(). Fixes bgo #619248

Fix a memory leak and removes regex quotation for zipnote
Comment 6 Carlos Garcia Campos 2010-06-08 12:54:49 UTC
Pushed to git master and gnome-2-30. Thanks!
Comment 7 Giacomo Perale 2010-06-21 22:16:13 UTC
Hi,

this patch breaks cbz support for all the cbz files on my system. All I get is a red bar claiming that evince doesn't support the application/x-cbz mimetype and an error message in console:

zipnote error: Invalid command arguments (can only specify one zip file)

I reverted it and the cbz files work again. I have zip 3.0 and unzip 6.0 here.
Comment 8 Juanjo Marín 2010-06-23 20:02:53 UTC
Thanks Giacomo, I _really_ appreciate your feedback !

The patch was a little bit tricky and I overlooked a fundamental detail: to quote the input for zipnote. I attach an incremental patch for fixing this. 

More feedback for the new cbz code will be welcome !
Comment 9 Juanjo Marín 2010-06-23 20:04:51 UTC
Created attachment 164425 [details] [review]
g_shell_quote() for zipnote
Comment 10 Bastien Nocera 2010-06-23 20:13:11 UTC
Reopening, as it's still broken :)
Comment 11 Giacomo Perale 2010-06-23 20:32:20 UTC
(In reply to comment #8)
> 
> The patch was a little bit tricky and I overlooked a fundamental detail: to
> quote the input for zipnote. I attach an incremental patch for fixing this. 
> 

I suspected something like that but didn't have the time to delve into the code. Anyway, your last patch fixes the bug here, thanks.
Comment 12 Carlos Garcia Campos 2010-06-24 08:40:10 UTC
Applied to git master and gnome-2-30 branch and released 2.30.3