diff options
author | Colomban Wendling <[email protected]> | 2025-03-17 23:21:52 +0100 |
---|---|---|
committer | Colomban Wendling <[email protected]> | 2025-03-17 23:21:52 +0100 |
commit | ab4d28abfed054b5e95c31194410e76ddd5cd6b2 (patch) | |
tree | e8b1bb6f1ee3699c2c33b9b443d58ee9fd855f02 /src | |
parent | 51a2a84bcd7bd10ff53cf87b58e4b3ec89011df1 (diff) | |
download | engrampa-rar7pwd.tar.bz2 engrampa-rar7pwd.tar.xz |
rar: Fix asking password for encrypted archives with RAR7rar7pwd
RAR 7.0 outputs a different error when password is missing:
>
> Incorrect password for foo.rar
> Incorrect password for foo.rar
> Cannot find volume foo.r00
Whereas RAR 6.21 doesn't output the last 2 lines.
The error about volumes confuses the parser thinking there's a volume
issue, which hides the incorrect password one.
Note that RAR 7.0 outputs this *most of the time*, but once in a while
it'll also skip the last 2 lines. Whether it is a race condition or
not, it at least happens often enough with RAR 7.0 to consider this its
normal behavior and handle it.
Fixes #526.
Diffstat (limited to 'src')
-rw-r--r-- | src/fr-command-rar.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/fr-command-rar.c b/src/fr-command-rar.c index 03e191b..880bfe9 100644 --- a/src/fr-command-rar.c +++ b/src/fr-command-rar.c @@ -697,7 +697,12 @@ fr_command_rar_handle_error (FrCommand *comm, volume_filename = g_path_get_basename (line + strlen ("Cannot find volume ")); error->gerror = g_error_new (FR_ERROR, error->status, _("Could not find the volume: %s"), volume_filename); g_free (volume_filename); - break; + + /* RAR7 complains about missing volume for incorrect passwords + * as well, so don't make this a definite error in case we also + * had an incorrect password one earlier */ + if (! IS_OUTPUT_TYPE (FR_COMMAND_RAR (comm), FR_COMMAND_RAR_TYPE_RAR7)) + break; } } } |