https://bugs.kde.org/show_bug.cgi?id=463647
Bug ID: 463647 Summary: Slow start on network mounts because of image icon lookups + may broken UI Classification: Applications Product: okular Version: 22.08.3 Platform: Ubuntu OS: Linux Status: REPORTED Severity: normal Priority: NOR Component: general Assignee: okular-de...@kde.org Reporter: mi.sel...@hotmail.de Target Milestone: --- Created attachment 154918 --> https://bugs.kde.org/attachment.cgi?id=154918&action=edit wrong icons in UI SUMMARY Preamble: I'm using okular to view PDF files which are on a samba network storage. The storage is mounted via CIFS to the local filesystem. I'm discovered that sometimes it will take several seconds (20 or more) to open and view small PDF files. The waiting time increases when I'm connected via VPN (OpenVpn, Wireguard, ..., doesn't matter) and it will take more than a minute to display these files. After that I was looking for some bug reports and found some old ones with okular and CIFS, but they are solved or 9 years without a message. So after some weeks I started testing again. - (Windows 10+11 shows the PDF files nearly instantly.) - Copying the file to the local storage and opening files there is way faster, than opening okular in the mounted storage path. - Evince on this machine also shows the files instantly. -> so the network connection and CIFS are working fine - Then I discovered, that PDF files on the CIFS mount path will open faster when there are no sub-directories. - The other way around: opening files in multiple subdirectores paths will cause long waiting times in okular. - Then I discovered that the same thing is happening when no file is selected at all and okular was simply started on a CIFS mount path: long sub-path -> long starting time for okular -> My thought: okular is looking for files in the current directory, may in the whole path. -> So I used some tools to track the accessed files of an okular program start. The problem: The annotation widget module of okular is looking for icon images in the current working directory when they are not included in the stamp.svg or loaded via the theme. On each start of okular, okular will look for some images with a set list of image extensions in the current working directory, when the icon/image name was not previously cached via an id in some SVG file or was loaded as icon via the theme. e.g. - there is no id 'bookmark-new' in the stamp.svg or the icon theme -> okular will look for 'bookmark-new', 'bookmark-new.3fr', ... [long list] ..., 'bookmark-new.png', ... [...].tiff, ...svg, ... in the current working directory. There are 66 lookups for this filename. This happens on each start - for each okular instance. -> the same goes for --> 'help-about', 'kde', 'okular' (see https://github.com/KDE/okular/blob/master/part/annotationwidgets.cpp#L430) -> if you open the annotation settings there will be lookups for more files. see the list in https://github.com/KDE/okular/blob/master/part/annotationwidgets.cpp#L366 -> These icon file lookups will happen when the class PixmapPreviewSelector will load some icons files. Each time an instance is created and icon names added. -> Massive slow down on 'slow' data storage drives / mount points. -> If there are files with this names, this will break the UI (See attachment). STEPS TO REPRODUCE As it is way simpler to recreate and test a broken UI, as to setup some 'slow, cifs mounted, long sub path PDF files' -> I will go with this, as it is the same bug. But there are more steps. File Lookup: 1. create / download some small png file, and copy+rename it to 'okular.png', 'kde.png', 'help-about.png', 'Note.png', 'NewParagraph.png', 'Paragraph.png', 'Insert.png', 'Help.png', 'Key.png', 'Comment.png' 2. open up a terminal/console, change the directory to the one containing the files from step 1 3. start okular from the terminal/console in this path > this will load access some of the files > you can check this e.g. with 'strace' or use she tool from the answer of this > question: > https://unix.stackexchange.com/questions/18844/list-the-files-accessed-by-a-program >> command: tracefile okular | grep -E '\.\/' Broken UI: (see attachment) 4. open a PDF file 5. may enable/show annotation tools 6. open stamp list To recreate the slow okular program start follow this procedure: 1. mount some samba net storage with CIFS > mkdir /smb_cifs_mountpoint > mount -t cifs -o username=<username>,uid=$(id -u),gid=$(id -g) > //<smb_host_or_ip>/share "/smb_cifs_mountpoint" 2. create long path: > mkdir -p /smb_cifs_mountpoint/a/b/c/d/e/f/g/h/i 3. change directory: > cd /smb_cifs_mountpoint/a/b/c/d/e/f/g/h/i 4. start okular: > okular OBSERVED RESULT - on CIFS mount: long waiting time to view/open a PDF file - broken UI (wrong icons) when file names exist on current path EXPECTED RESULT - no lookup of any icon image files in current working directory - only look for icon files in okular resource directory or current icon theme SOFTWARE/OS VERSIONS Linux/KDE Plasma: Ubuntu 22.10 (available in About System) KDE Plasma Version: 5.26.4 KDE Frameworks Version: 5.100.0 Qt Version: 5.16.6 ADDITIONAL INFORMATION Not all icons could be overwritten in this way. Mostly the annotation widget/module is affected. maybe the relevant place to look for the bug is: > AnnotationUtils::loadStamp in core/annotations.cpp or > PixmapPreviewSelector::setIcon in part/annotationwidgets.cpp may relevant documentation: > https://doc.qt.io/qt-6/qpixmap.html#load > https://doc.qt.io/qt-6/resources.html > https://doc.qt.io/qt-6/qstandardpaths.html#locate May the loading of some other resources (outside the annotation module) should also be checked? > https://github.com/KDE/okular/blob/master/part/data/CMakeLists.txt I don't know if there is a security problem with manipulated images - as at least 4 image files will always be loaded if present in the working path. -- You are receiving this mail because: You are watching all bug changes.