Bug 475781

Summary: Prompt the encountered permission problems after scanning with non-root user
Product: [Applications] filelight Reporter: Xinhui Yang <cyan>
Component: generalAssignee: Unassigned bugs mailing-list <unassigned-bugs>
Status: CONFIRMED ---    
Severity: normal CC: cyan, martin.sandsmark, nate
Priority: NOR Keywords: usability
Version: 22.08.3   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: filelight showing access deined messages in the terminal during a root filesystem scan with normal user
filelight showing access deined messages in the terminal during a root filesystem scan as root

Description Xinhui Yang 2023-10-18 07:18:25 UTC
Created attachment 162401 [details]
filelight showing access deined messages in the terminal during a root filesystem scan with normal user

SUMMARY

When running as the normal user, if we are scanning the entire root directory, any permission problems are ignored and never shown to the user after collecting usage information. The error message is only visible in the stdout if running from a terminal.

Besides that, the result might be inaccurate if those directories contain any files, which is always less than the actual usage.

STEPS TO REPRODUCE
1. Make a directory as root, with permission 0700 (makes it unreadable to other users)
2. Put some large files in it (in order to make some difference between scans with and without root)
2. Start filelight as the normal user
3. Start scan

OBSERVED RESULT

No error window is shown, and the scan is performed as the directories and files that have insufficient permissions do not exist, thus generating an inaccurate result.
If run in a terminal, permission errors are printed to stdout, as shown in the attachment.

EXPECTED RESULT

There are two possible ways to improve this behavior:
1. Filelight shows a warning window, which contains the directories it can not read, and tells the user that the result might be inaccurate.
2. Filelight prompts the user to run filelight as the superuser if such file or directory is encountered.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: AOSC OS 11.0.1
KDE Plasma Version: 5.27.2
KDE Frameworks Version: 5.103.0
Qt Version: 5.15.5

ADDITIONAL INFORMATION

Here are some examples of possible directories unreadable or unexecutable to normal users, and may have significant disk space usage:
- Some directories in /var/log
- /var/lib/machines (systemd-nspawn(1) containers)
- /var/lib/docker
- /var/lib/libvirt
Comment 1 Xinhui Yang 2023-10-18 07:21:32 UTC
Created attachment 162402 [details]
filelight showing access deined messages in the terminal during a root filesystem scan as root

If run as root, no permission problems are printed in the terminal.
The total disk usage is significantly larger than the scan performed as a normal user.