diff -Naur engrampa-1.14.1.orig/src/fr-command-7z.c engrampa-1.14.1/src/fr-command-7z.c --- engrampa-1.14.1.orig/src/fr-command-7z.c 2016-04-07 14:37:58.000000000 +0300 +++ engrampa-1.14.1/src/fr-command-7z.c 2016-09-22 20:49:27.295022320 +0300 @@ -39,7 +39,8 @@ static void fr_command_7z_class_init (FrCommand7zClass *class); static void fr_command_7z_init (FrCommand *afile); static void fr_command_7z_finalize (GObject *object); -static gboolean spd_support; +static gboolean spd_support = FALSE; +static gboolean unexpected_end_of_archive = FALSE; /* Parent Class */ @@ -125,6 +126,9 @@ comm->multi_volume = (strcmp (fields[1], "+") == 0); g_strfreev (fields); } + else if (strncmp (line, "Unexpected end of archive", 25) == 0) { + unexpected_end_of_archive = TRUE; + } return; } @@ -371,11 +375,20 @@ if (from_file != NULL) fr_process_add_arg_concat (comm->process, "-i@", from_file, NULL); + if (from_file == NULL) + for (scan = file_list; scan; scan = scan->next) + /* Files prefixed with '@' need to be handled specially */ + if (g_str_has_prefix (scan->data, "@")) + fr_process_add_arg_concat (comm->process, "-i!", scan->data, NULL); + fr_process_add_arg (comm->process, "--"); fr_process_add_arg (comm->process, comm->filename); + if (from_file == NULL) for (scan = file_list; scan; scan = scan->next) - fr_process_add_arg (comm->process, scan->data); + /* Skip files prefixed with '@', already added */ + if (!g_str_has_prefix (scan->data, "@")) + fr_process_add_arg (comm->process, scan->data); fr_process_end_command (comm->process); } @@ -399,11 +412,20 @@ if (from_file != NULL) fr_process_add_arg_concat (comm->process, "-i@", from_file, NULL); + if (from_file == NULL) + for (scan = file_list; scan; scan = scan->next) + /* Files prefixed with '@' need to be handled specially */ + if (g_str_has_prefix (scan->data, "@")) + fr_process_add_arg_concat (comm->process, "-i!", scan->data, NULL); + fr_process_add_arg (comm->process, "--"); fr_process_add_arg (comm->process, comm->filename); + if (from_file == NULL) for (scan = file_list; scan; scan = scan->next) - fr_process_add_arg (comm->process, scan->data); + /* Skip files prefixed with '@', already added */ + if (!g_str_has_prefix (scan->data, "@")) + fr_process_add_arg (comm->process, scan->data); fr_process_end_command (comm->process); } @@ -453,11 +475,22 @@ if (from_file != NULL) fr_process_add_arg_concat (comm->process, "-i@", from_file, NULL); + if (from_file == NULL) + for (scan = file_list; scan; scan = scan->next) + /* Files prefixed with '@' need to be handled specially */ + if (g_str_has_prefix (scan->data, "@")) + fr_process_add_arg_concat (comm->process, "-i!", scan->data, NULL); + fr_process_add_arg (comm->process, "--"); fr_process_add_arg (comm->process, comm->filename); + if (from_file == NULL) for (scan = file_list; scan; scan = scan->next) - fr_process_add_arg (comm->process, scan->data); + /* Skip files prefixed with '@', already added */ + if (!g_str_has_prefix (scan->data, "@")) + fr_process_add_arg (comm->process, scan->data); + + if (unexpected_end_of_archive) fr_process_set_ignore_error (comm->process, TRUE); fr_process_end_command (comm->process); } @@ -507,7 +540,7 @@ return; } - if (error->status <= 1) { + if ((error->status <= 1) || (unexpected_end_of_archive)) { error->type = FR_PROC_ERROR_NONE; } else { @@ -572,7 +605,8 @@ if (is_mime_type (mime_type, "application/x-rar") || is_mime_type (mime_type, "application/x-cbr")) { - if (! check_command || g_file_test ("/usr/lib/p7zip/Codecs/Rar29.so", G_FILE_TEST_EXISTS)) + if (! check_command || g_file_test ("/usr/lib/p7zip/Codecs/Rar29.so", G_FILE_TEST_EXISTS) || g_file_test ("/usr/lib/p7zip/Codecs/Rar.so", G_FILE_TEST_EXISTS) + || g_file_test ("/usr/libexec/p7zip/Codecs/Rar29.so", G_FILE_TEST_EXISTS) || g_file_test ("/usr/libexec/p7zip/Codecs/Rar.so", G_FILE_TEST_EXISTS)) capabilities |= FR_COMMAND_CAN_READ; } else