Skip to content

extractor: Drop recursive delete on failure to prevent data loss

Ondrej Holy requested to merge wip/oholy/drop-recursive-delete into master

Recursive delete has been added by commit 58ac8fc5 to remove already created directories when extraction fails because of an invalid password. In fact, it deletes the whole destination_dir also in case of other failures, which is maybe not the best approach, but ok. However, a problem is that gnome-autoar allows extraction in non-empty destination, so this might remove also files which were not initially created by gnome-autoar. Fortunately, nautilus and gnome-shell currently always extracts in an extra directory. But what is worse is the fact, that if the files in the archive have a common prefix, then the destination_dir is actually a parent of that extra directory in the case of nautilus and gnome-shell (but API allows to set completely unrelated path)! So this can easily cause huge data loss! It would probably be better to create parent directories only when archive_read_data_block succeeds instead of deleting them later. Alternatively, gnome-autoar could track which files were written and deletes just those on that list. But for now, let's just remove the code for recursive delete and do not care about leftover files...

Merge request reports