Avoid that Krusader crashes when trying to view any archive using the ark part
ClosedPublic

Authored by asensi on Aug 18 2019, 7:20 PM.

Details

Summary

FIXED: [ 409722 ] Krusader crash when trying to view any archive using the ark part
BUG: 409722

Test Plan

In one tab of e.g. Konsole execute:

touch /tmp/really_empty.zip
ln -s /dev/zero /tmp/too_big.zip
zip /tmp/no_access.zip /etc/fstab
chmod a-rwx /tmp/no_access.zip
krusader -d

Press F3 to try to view a compressed file
See in the Konsole tab:

[...]-debug default PanelViewer::openFile(KFileItem)::<lambda@281 # openFile completed: ' QUrl("file:///[...]") '

Close the window of the viewer.

Press F3 to try to view /tmp/really_empty.zip
See in the Konsole tab:

[...]-debug default PanelViewer::openFile(KFileItem)::<lambda@275 # openFile canceled: ' QUrl("file:///tmp/really_empty.zip") '

Close the window of the viewer.

Press F3 to try to view /tmp/too_big.zip
See a viewer window with the message:

The file /dev/zero could not be loaded, as it was not possible to read from it.
Check if you have read access to this file.    
[Try Again] [Close]

press the "Try Again" button. See in the Konsole tab:

[...]-debug default PanelViewer::openFile(KFileItem)::<lambda@275 # openFile canceled: ' QUrl("file:///tmp/too_big.zip") '

Close the window of the viewer.

Press F3 to try to view /tmp/no_access.zip
See a "No permissions to view this file" message.

Try F3 to view other kind of files like text, jpg, html, etc.

Diff Detail

Repository
R167 Krusader
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
asensi requested review of this revision.Aug 18 2019, 7:20 PM
asensi created this revision.

Haven't tested the patch, but the change looks good to me.

krusader/KViewer/panelviewer.cpp
263–268

I'd put this information in the commit message instead. Comments gets outdated pretty easily ;)

asensi edited the test plan for this revision. (Show Details)Sep 1 2019, 5:15 PM
nmel accepted this revision.Sep 6 2019, 6:02 AM
nmel added a subscriber: nmel.

Reviewed and tested - works good. Thanks for the fix, Toni!

This revision is now accepted and ready to land.Sep 6 2019, 6:02 AM
gengisdave accepted this revision.Sep 11 2019, 8:56 AM
gengisdave added a subscriber: gengisdave.

Tested, it works perfectly with every archive as if it had been opened with Ark

Some tests were also performed by Moritz Bunkus (https://bugs.kde.org/show_bug.cgi?id=411446#c10) and he didn't see any problem.

Thanks Elvis, Nikita, Davide, and Moritz :-)

This revision was automatically updated to reflect the committed changes.