shundhammer / qdirstat

QDirStat - Qt-based directory statistics (KDirStat without any KDE - from the original KDirStat author)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

QDirStat tries to use a non-existing file manager

C0rn3j opened this issue · comments

I cannot right click and "Open folder" in QDirStat.

My main file explorer is Dolphin yet QDirStat tries to launch non-existing konqueror, I assume due to the fact it detects my DE as Plasma.

2022-04-26 09:34:32.252 [2655060] <Info>    Logger.cpp:143 openLogFile():  -- Log Start --
2022-04-26 09:34:32.252 [2655060] <Info>    main.cpp:59 logVersion():  QDirStat-1.8 built with Qt 5.15.2
2022-04-26 09:34:32.384 [2655060] <Debug>   DebugHelpers.cpp:134 dumpExcludeRules():  <ExcludeRule ".snapshot">
2022-04-26 09:34:32.385 [2655060] <Info>    Cleanup.cpp:394 desktopSpecificApps():  Detected desktop "KDE"
2022-04-26 09:34:32.385 [2655060] <Info>    Cleanup.cpp:447 desktopSpecificApps():  %filemanager => "konqueror --profile filemanagement"
2022-04-26 09:34:32.385 [2655060] <Info>    Cleanup.cpp:447 desktopSpecificApps():  %terminal => "konsole --workdir %d"
2022-04-26 09:34:32.385 [2655060] <Debug>   DirTreeModel.cpp:662 sort():  Sorting by NameCol ascending
2022-04-26 09:34:32.385 [2655060] <Debug>   MainWindowLayout.cpp:78 changeLayout():  Changing to layout L2
2022-04-26 09:34:32.386 [2655060] <Info>    PkgQuery.cpp:66 checkPkgManagers():  Checking available supported package managers...
2022-04-26 09:34:32.386 [2655060] <Info>    SysUtil.cpp:89 runCommand():  Command not found: /usr/bin/dpkg
2022-04-26 09:34:32.386 [2655060] <Info>    SysUtil.cpp:89 runCommand():  Command not found: /bin/rpm
2022-04-26 09:34:32.386 [2655060] <Debug>   SysUtil.cpp:103 runCommand():  /usr/bin/pacman -Qo /usr/bin/pacman
2022-04-26 09:34:32.467 [2655060] <Info>    PkgQuery.cpp:95 checkPkgManager():  Found primary package manager pacman
2022-04-26 09:34:32.468 [2655060] <Info>    PkgQuery.cpp:84 checkPkgManagers():  Found pacman
2022-04-26 09:34:32.468 [2655060] <Info>    MainWindow.cpp:178 checkPkgManagerSupport():  No package manager support for getting a file lists cache
2022-04-26 09:34:32.468 [2655060] <Info>    MainWindow.cpp:1114 toggleVerboseSelection():  Verbose selection is now off. Change this with Shift-F7.
2022-04-26 09:34:32.486 [2655060] <Info>    DirTree.cpp:130 startReading():     url: "/home/c0rn3j/Nextcloud"
2022-04-26 09:34:32.492 [2655060] <Debug>   MountPoints.cpp:439 findNtfsDevices():  No NTFS devices found
2022-04-26 09:34:32.494 [2655060] <Info>    MountPoints.cpp:355 read():  Found duplicate mount of /dev/mapper/Adata-root at /var/lib/lxd/storage-pools/default
2022-04-26 09:34:32.495 [2655060] <Info>    DirTree.cpp:133 startReading():  device: /dev/mapper/ArchVol-root
2022-04-26 09:34:32.495 [2655060] <Debug>   DirTreeModel.cpp:662 sort():  Sorting by NameCol ascending
2022-04-26 09:34:32.495 [2655060] <Debug>   MainWindow.cpp:834 expandTreeToLevel():  Expanding tree to level 1
2022-04-26 09:34:32.550 [2655060] <Info>    DirTree.cpp:663 detectClusterSize():  Cluster size: 8 blocks (4.0 kB)
2022-04-26 09:34:32.550 [2655060] <Debug>   DirTree.cpp:665 detectClusterSize():  Derived from /home/c0rn3j/Nextcloud/Documents/Turing_complete_Maze.sh 808 Bytes (allocated: 4.0 kB)
2022-04-26 09:34:32.705 [2655060] <Debug>   MainWindow.cpp:834 expandTreeToLevel():  Expanding tree to level 1
2022-04-26 09:34:32.724 [2655060] <Info>    MainWindow.cpp:489 readingFinished():  
2022-04-26 09:34:32.724 [2655060] <Info>    MainWindow.cpp:438 idleDisplay():  
2022-04-26 09:34:32.725 [2655060] <Debug>   DirTreeModel.cpp:662 sort():  Sorting by PercentNumCol descending
2022-04-26 09:34:32.725 [2655060] <Debug>   DirTreeModel.cpp:662 sort():  Sorting by PercentNumCol descending
2022-04-26 09:34:32.725 [2655060] <Debug>   MainWindow.cpp:452 idleDisplay():  No current branch - expanding tree to level 1
2022-04-26 09:34:32.725 [2655060] <Debug>   MainWindow.cpp:834 expandTreeToLevel():  Expanding tree to level 1
2022-04-26 09:34:32.727 [2655060] <Info>    MainWindow.cpp:495 readingFinished():  Reading finished after 0.232 sec
2022-04-26 09:34:38.796 [2655060] <Debug>   FileTypeStats.cpp:224 removeCruft():  Merged 35 suffixes to <NO SUFFIX>: *.1, *.1230, *.1h34m, *.2, *.2h19m, *.3h6m, *.afpalette, *.check_cache, *.cpp - rngbrute, *.dat-bindingofisaac, *.example, *.i386, *.in:92, *.includecache, *.internal, *.kdenlive, *.khotkeys, *.l68, *.litemod, *.logicdata, *.m3u, *.manifest, *.markdown, *.network, *.options, *.p7b, *.p7s, *.profile, *.properties, *.ps1, *.s68, *.settings, *.t4, *.trimmed, *.阿里旺旺接收的可疑文件
2022-04-26 09:34:38.796 [2655060] <Debug>   FileTypeStats.cpp:227 removeCruft():  Merged: 57 files (3.2 MB)
2022-04-26 09:34:38.796 [2655060] <Debug>   FileTypeStats.cpp:303 sanityCheck():  Unaccounted in categories: 14.5 MB of 90.0 GB (0.02%)
2022-04-26 09:34:38.797 [2655060] <Debug>   FileTypeStatsWindow.cpp:269 populate():  Discarding 152 suffixes below <other>: *.kra, *.wallet, *.sn8encode5, <No Extension>, *.pkg, *.idb, *.sl2, *.xhtml, *.fwpkg, *.pbp, *.afdesign, *.sn8encode4, *.hex, *.resx, *.hexencode, *.ttf, *.ctb, *.vcf, *.azw3, *.ft, *.pak, *.pdb, *.cap, *.json, *.obj, *.hg, *.res, *.fw, *.tga, *.tibkp, *.inf, *.azw, *.kdbx, *.ts, *.lib, *.ico, *.idx, *.cs, *.blend, *.sn8encode, *.asm, *.dump, *.dds, *.chm, *.3mf, *.ncx, *.sys, *.sldprt, *.step, *.f3d, *.opf, *.list, *.sample, *.out, *.sh, *.tcl, *.meta, *.crt, *.yaml, *.pkc, *.pf2, *.ptf, *.sqlite, *.conf, *.fzz, *.woff, *.dat, *.hzk, *.j2, *.gmx, *.ini, *.changes, *.dmp, *.pimx, *.mscz, *.cfg, *.sort, *.ino, *.cat, *.save, *.sql, *.dylib, *.x68, *.backup, *.cf, *.csproj, *.toml, *.files, *.user, *.pseudo, *.binds, *.info, *.elf, *.key, *.patch, *.gramps, *.class, *.make, *.fzpz, *.lbx, *.rsc, *.sig, *.cue, *.pem, *.drawio, *.s, *.nsi, *.config, *.enc, *.pfx, *.local, *.service, *.hccap, *.url, *.csr, *.zaloha, *.bld, *.hccapx, *.sfo, *.hook, *.bat, *.zone, *.old, *.scad, *.def, *.yml, *.timer, *.com, *.lua, *.aup, *.sln, *.dist, *.reg, *.nfo, *.keys, *.phh, *.chat, *.rules, *.new, *.rtf, *.cipher, *.netdev, *.srl, *.indexed, *.pub, *.dec, *.fcgi, *.opts, *.mft, *.lock, *.marks, *.pot
2022-04-26 09:41:57.641 [2655060] <Debug>   LocateFileTypeWindow.cpp:112 populate():  Locating all files ending with ".png" below /home/c0rn3j/Nextcloud
2022-04-26 09:41:57.763 [2655060] <Debug>   LocateFileTypeWindow.cpp:122 populate():  763 directories
2022-04-26 09:42:41.056 [2655060] <Debug>   OutputWindow.cpp:40 OutputWindow():  Creating
2022-04-26 09:42:41.056 [2655060] <Debug>   Cleanup.cpp:355 defaultShells():  Default shell: /bin/zsh
2022-04-26 09:42:41.056 [2655060] <Debug>   Cleanup.cpp:232 chooseShell():  No custom shell configured - using /bin/zsh
2022-04-26 09:42:41.057 [2655060] <Info>    OutputWindow.cpp:442 startNextProcess():  Starting: konqueror --profile filemanagement '/home/c0rn3j/Nextcloud/HugeFiles/Pics/dum_2003' &
2022-04-26 09:42:41.083 [2655060] <WARNING> OutputWindow.cpp:122 addStderr():  zsh:1: command not found: konqueror
2022-04-26 09:42:41.083 [2655060] <Debug>   OutputWindow.cpp:200 processFinished():  Process finished normally.
2022-04-26 09:42:41.083 [2655060] <Debug>   OutputWindow.cpp:232 processFinished():  Emitting lastProcessFinished() err: 1
2022-04-26 09:42:41.083 [2655060] <Debug>   MainWindow.cpp:799 cleanupFinished():  Error count: 1
2022-04-26 09:42:41.083 [2655060] <Debug>   OutputWindow.cpp:309 closeIfDone():  No more processes to watch. Auto-closing.
2022-04-26 09:42:41.083 [2655060] <Debug>   OutputWindow.cpp:57 ~OutputWindow():  Destructor
2022-04-26 09:42:44.173 [2655060] <Info>    Logger.cpp:84 ~Logger():  -- Log End --

Yes, most likely.

You are right: That could be done a bit better. It could check first if the filemanager that has been guessed is available; and then do some fallback cascade if it's not.

For the time being, please either replace %filemanager in that cleanup action (Menu Edit -> Configure) with the one that you would like to use. If you don't know, use xdg-open; then it will use your desktop's default (if that is configured correctly in the desktop).

Or you could set the $QDIRSTAT_DESKTOP environment variable which overrides the default $XDG_CURRENT_DESKTOP. See https://github.com/shundhammer/qdirstat#new-features .

Digging a bit deeper into this, I found out that the problem is really the error reporting. You should really see this:

no-konsole

But those two particular default cleanup actions have their output window policy set to "ShowNever".

And the second one even has a comment explaining why: "Make KDE konsole shut up". And that made me remember that it was those KDE programs (and only them!) that kept misbehaving in every possible way, and that was one of them.

So proper error reporting (policy "report if error") would always open the output window with the error message:

Screenshot_2022-04-29_23-30-14

(depending on your desktop and Qt / KDE settings)

Because some genius decided that any message that Qt itself reported would be worthwhile to be dumped on stderr, even if it's just diagnostic output like here; and some other genius at TrollTech decided that it's of earth-shattering importance to always tell the user those two messages, even if it should really be only with something like --verbose --debug.

This is why those two cleanup actions are set to this policy "never show". And this is why you never see that error in the output window, just in the log.

So: Sorry, but I am fed up with pampering broken KDE applications. It's for them that I had to change that proper error reporting policy to something that sometimes (in pathological scenarios) hides an error in the log rather than explicitly showing the user.

I am not going to pollute my code even more with more insane workarounds that only those broken KDE applications need.

While this STDERR pollution is certainly unfortunate, it seems unrelated to the issue I posted initially.

It is sad that QDirStat can't easily display errors from Qt apps, but it does not seem to me that it prevents performing a command -v konqueror or an equivalent check to verify a file manager is present before defaulting to it, Qt or not.

Hi, would it be possible to reopen this issue, as it is not about whether QDirStat is capable of logging an error properly or not, but about it using a file manager that does not exist on the system?

Would it be possible to use the approach you mentioned?

It could check first if the filemanager that has been guessed is available; and then do some fallback cascade if it's not.

One could also use D-Bus' org.freedesktop.FileManager1.

https://www.freedesktop.org/wiki/Specifications/file-manager-interface/

As for dealing with showing only proper errors, why not handle it as the app is telling you - an error that you should show?
That way the user would see what is actually happening, and if they cared enough they would find the relevant issue on Qt's/Plasma's bug tracker and make noise about it there.

Any user who has enough know-how to do something about this should also know to check the log. That's what it's there for.

Also, since the standard cleanup actions can be configured in the GUI, it's very easy to replace that %filemanager with a custom value; which may be something concrete like pcmanfm, or yet another redirection like xdg-open. It's all there.

While yes, user can override the default value, I do not believe the default value should pick an essentially random file manager and hope it is there, instead of querying the system for it.

It's not random. It's the usable KDE file manager, unlike Dolphin that is dumbed down to the point of being pretty much useless.