Bug 395736 - F3 and Shift+F3 don't show error message if file has no read permission or it's a symlink to such file
Summary: F3 and Shift+F3 don't show error message if file has no read permission or it...
Status: RESOLVED WORKSFORME
Alias: None
Product: krusader
Classification: Applications
Component: krviewer (show other bugs)
Version: Git
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Krusader Bugs Distribution List
URL:
Keywords: reproducible, triaged
Depends on:
Blocks:
 
Reported: 2018-06-22 10:13 UTC by Toni Asensi Esteve
Modified: 2020-03-10 21:48 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
error dialog for F3 (39.90 KB, image/png)
2018-06-28 06:35 UTC, Nikita Melnichenko
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Toni Asensi Esteve 2018-06-22 10:13:31 UTC
If the user has not permissions to see a file (e.g. /vmlinuz.old) and presses F3 (or Shift+F3)... Krusader opens a window and it's closed; however if F4 is pressed, then Krusader says "No permissions to edit this file.", which is correct.

Note: Maybe it should be better that the error message was 'No permissions to edit the file "<name>".' to avoid confusions because e.g. the user might have incorrectly written the name.
Comment 1 Nikita Melnichenko 2018-06-28 06:34:34 UTC
On my side:
1. If Shift+F3 is used, nothing happens - no error, no opening and closing windows. It's a bug.
2. For F3, a correct error dialog is shown. I'll attach a screenshot.
Comment 2 Nikita Melnichenko 2018-06-28 06:35:39 UTC
Created attachment 113618 [details]
error dialog for F3
Comment 3 Toni Asensi Esteve 2018-06-28 09:29:13 UTC
> 2. For F3, a correct error dialog is shown. I'll attach a screenshot.

Thanks, Nikita! I've tried pressing F3 on /swapfile and I see the same error message as you see, although pressing F3 on /vmlinuz.old I don't see any error dialog (just a window that is closed immediately). :-?

Those are the permission of those files:

    $ ll /swapf* /vm*
    -rw------- 1 root root 545367040 abr 23 10:31 /swapfile
    lrwxrwxrwx 1 root root        30 jun 17 16:08 /vmlinuz -> boot/vmlinuz-4.15.0-23-generic
    lrwxrwxrwx 1 root root        30 jun 17 16:08 /vmlinuz.old -> boot/vmlinuz-4.15.0-22-generic

    $ ll /boot/vmlinuz-4.15.0-23-generic
    -rw------- 1 root root 8257272 may 23 19:49 /boot/vmlinuz-4.15.0-23-generic

If I execute
    less /vmlinuz.old; less /swapfile; less /non_existant_file
then I see
    /vmlinuz.old: Permission denied
    /swapfile: Permission denied
    /non_existant_file: No such file or directory
but using F3 to see /vmlinuz.old (or /vmlinuz) I don't see any error message (at least using Kubuntu 18.04), does it happen to you, Nikita?
Comment 4 Toni Asensi Esteve 2018-06-28 09:47:56 UTC
If I go to the /boot/ file and I use F3 to view all the vmlinuz* files, everything works as it's expected.

Maybe the problem is in panelfunc.cpp, in

    if (!fileitem->isReadable()) {
        KMessageBox::sorry(0, i18n("No permissions to view this file."));
        return;
    }
    // call KViewer.
    KrViewer::view(files()->getUrl(fileName));
    // nothing more to it!

because the user can't read /vmlinuz (nor vmlinuz.old) but `fileitem->isReadable()` says that it is readable (because it's only inspecting the symlink file)?
Comment 5 Nikita Melnichenko 2018-06-29 05:30:13 UTC
I confirm that if you press F3 on a symlink to a file which doesn't have read permission, nothing happens (I don't see any windows that are closed immediately).
Comment 6 Nikita Melnichenko 2018-06-29 05:32:40 UTC
Updated summary line.
Comment 7 Toni Asensi Esteve 2018-07-09 18:28:07 UTC
This bug report is possibly related to https://bugs.kde.org/show_bug.cgi?id=396132
Comment 8 Toni Asensi Esteve 2020-03-10 21:48:22 UTC
Thanks, Nikita!