On Tue, 2013-04-02 at 04:55 -0700, Matt Kraai wrote: > Evince can currently use either the proprietary unrar or the free > software unrar to decompress comics documents. The free software > unrar cannot handle some RAR files, however. Please add support for > unar, which is free software and can handle more RAR files than the > free software unrar.
Hi, Attached is an (admittedly hacky) patch that nukes the rarlabs and gna rar support for unar. unar is not a direct drop in replacement as it uses different commands to list and extract files. I'm not sure if it would be a better idea to write a wrapper for unar and lsar instead. In the long run Evince should probably use libarchive for all compressed files. -- Cheers, Sven Arvidsson http://www.whiz.se PGP Key ID 6FAB5CD5
diff -urp ../evince-3.18.0/backend/comics/comics-document.c ./backend/comics/comics-document.c --- ../evince-3.18.0/backend/comics/comics-document.c 2015-04-26 11:38:26.000000000 +0200 +++ ./backend/comics/comics-document.c 2015-10-11 22:11:46.071822078 +0200 @@ -53,8 +53,7 @@ typedef enum { - RARLABS, - GNAUNRAR, + UNAR, UNZIP, P7ZIP, TAR @@ -106,11 +105,8 @@ typedef struct { } ComicBookDecompressCommand; static const ComicBookDecompressCommand command_usage_def[] = { - /* RARLABS unrar */ - {"%s p -c- -ierr --", "%s vb -c- -- %s", NULL , FALSE, NO_OFFSET}, - - /* GNA! unrar */ - {NULL , "%s t %s" , "%s -xf %s %s" , FALSE, NO_OFFSET}, + /* unar */ + {NULL , "%s %s" , "%s -q -f -D %s -o %s" , FALSE, NO_OFFSET}, /* unzip */ {"%s -p -C --" , "%s %s" , NULL , TRUE , OFFSET_ZIP}, @@ -281,6 +277,12 @@ comics_generate_command_lines (ComicsDoc g_strdup_printf (command_usage_def[type].decompress_tmp, quoted_command, quoted_file, comics_document->dir); + if (type == UNAR) { + comics_document->decompress_tmp = + g_strdup_printf (command_usage_def[type].decompress_tmp, + "unar", quoted_file, + comics_document->dir); + } g_free (quoted_file); g_free (quoted_command); @@ -313,52 +315,11 @@ comics_check_decompress_command (gchar * included in shared-mime-info */ if (!strcmp (mime_type, "application/x-cbr") || - !strcmp (mime_type, "application/x-rar")) { - /* The RARLAB provides a no-charge proprietary (freeware) - * decompress-only client for Linux called unrar. Another - * option is a GPLv2-licensed command-line tool developed by - * the Gna! project. Confusingly enough, the free software RAR - * decoder is also named unrar. For this reason we need to add - * some lines for disambiguation. Sorry for the added the - * complexity but it's life :) - * Finally, some distributions, like Debian, rename this free - * option as unrar-free. - * */ - comics_document->selected_command = - g_find_program_in_path ("unrar"); - if (comics_document->selected_command) { - /* We only use std_err to avoid printing useless error - * messages on the terminal */ - success = - g_spawn_command_line_sync ( - comics_document->selected_command, - &std_out, &std_err, - &retval, &err); - if (!success) { - g_propagate_error (error, err); - g_error_free (err); - return FALSE; - /* I don't check retval status because RARLAB unrar - * doesn't have a way to return 0 without involving an - * operation with a file*/ - } else if (WIFEXITED (retval)) { - if (g_strrstr (std_out,"freeware") != NULL) - /* The RARLAB freeware client */ - comics_document->command_usage = RARLABS; - else - /* The Gna! free software client */ - comics_document->command_usage = GNAUNRAR; - - g_free (std_out); - g_free (std_err); - return TRUE; - } - } - /* The Gna! free software client with Debian naming convention */ - comics_document->selected_command = - g_find_program_in_path ("unrar-free"); + !strcmp (mime_type, "application/x-rar")) { + comics_document->selected_command = + g_find_program_in_path ("lsar"); if (comics_document->selected_command) { - comics_document->command_usage = GNAUNRAR; + comics_document->command_usage = UNAR; return TRUE; } comics_document->selected_command = Only in ./backend/comics: comics-document.c~
signature.asc
Description: This is a digitally signed message part