Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash if picking up a cache file in starting directory (subtree root) #84

Closed
shundhammer opened this issue Sep 26, 2018 · 4 comments
Closed
Labels

Comments

@shundhammer
Copy link
Owner

This was reported by Ed Peguillan III edward.j.peguillan-1@ou.edu at the Debian Bugzilla:

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=909551

I installed qdirstat and launched it. It gave me a GTK(3?) prompt for choosing the directory I wish to scan. After choosing the directory and clicking "Open", it crashes.
The message given when run from the terminal is "Segmentation fault".
This happens when running with/without root privileges.

Log:

2018-09-24 22:36:10.956 [5046] <Info>    Logger.cpp:143 openLogFile():  -- Log Start --
2018-09-24 22:36:10.956 [5046] <Info>    main.cpp:44 logVersion():  QDirStat-1.4 built with Qt 5.7.1
2018-09-24 22:36:11.070 [5046] <Debug>   DirTreeModel.cpp:549 sort():  Sorting by NameCol ascending
2018-09-24 22:36:11.070 [5046] <Debug>   TreemapView.cpp:124 setSelectionModel():  
2018-09-24 22:36:11.071 [5046] <Info>    Cleanup.cpp:415 desktopSpecificApps():  Detected desktop "XFCE"
2018-09-24 22:36:11.071 [5046] <Info>    Cleanup.cpp:468 desktopSpecificApps():  %filemanager => "thunar"
2018-09-24 22:36:11.071 [5046] <Info>    Cleanup.cpp:468 desktopSpecificApps():  %terminal => "xfce4-terminal &"
2018-09-24 22:36:11.071 [5046] <Debug>   DebugHelpers.cpp:133 dumpExcludeRules():  <ExcludeRule ".snapshot">
2018-09-24 22:36:11.071 [5046] <Info>    MainWindow.cpp:818 toggleVerboseSelection():  Verbose selection is now off. Change this with Shift-F7.
2018-09-24 22:36:12.818 [5046] <Info>    DirTree.cpp:95 startReading():     url: "/home/yankee"
2018-09-24 22:36:12.818 [5046] <Info>    DirTree.cpp:98 startReading():  device: /dev/sda5
2018-09-24 22:36:12.818 [5046] <Debug>   DirReadJob.cpp:349 stat():  url: "/home/yankee"
2018-09-24 22:36:12.818 [5046] <Debug>   MainWindow.cpp:589 expandTreeToLevel():  Expanding tree to level 1
2018-09-24 22:36:12.835 [5046] <Debug>   DirReadJob.cpp:248 startReading():  Found cache file .qdirstat.cache.gz
2018-09-24 22:36:12.836 [5046] <Debug>   DirReadJob.cpp:260 startReading():  Using cache file /home/yankee/.qdirstat.cache.gz for /home/yankee
2018-09-24 22:36:12.836 [5046] <Debug>   DirReadJob.cpp:544 killAll():  NOT killing read job <root>
2018-09-24 22:36:12.836 [5046] <Debug>   DirReadJob.cpp:278 startReading():  Deleting subtree /home/yankee
2018-09-24 22:36:12.836 [5046] <Debug>   DirTree.cpp:237 deletingChildNotify():  Deleting child /home/yankee
2018-09-24 22:36:12.836 [5046] <Debug>   DirTreeModel.cpp:918 deletingChild():  Deleting child /home/yankee
2018-09-24 22:36:12.836 [5046] <Debug>   DirTreeModel.cpp:926 deletingChild():  beginRemoveRows for /home/yankee row 0
2018-09-24 22:36:12.836 [5046] <Debug>   DirTreeModel.cpp:984 invalidatePersistent():  Invalidating <QModelIndex row: 0 col: 0 /home/yankee >

Patrick Matthäi, the Debian maintainer of QDirStat, asked the bug reporter to check if it still crashes when he removes that cache file .qdirstat.cache.gz. The bug reporter wrote that it does not crash anymore then.

@shundhammer
Copy link
Owner Author

I suspect that this is a special case when the toplevel directory that QDirStat was started with already contains a cache file. The log says:

DirReadJob.cpp:544 killAll(): NOT killing read job

But still, the corresponding subtree is deleted internally:

DirReadJob.cpp:278 startReading(): Deleting subtree /home/yankee

which of course means that any subsequent attempt to access that now invalid subtree from the read job (that is still present) will fail, causing a segfault.

@shundhammer
Copy link
Owner Author

Temporary workaround until a fix is available:

Either start QDirStat with the --cache-file option for such a directory or start it one directory level above or move the cache file out of the way temporarily.

Working on a real fix, of course.

@shundhammer
Copy link
Owner Author

BTW nice to see that at least some people are actually using that "dump cache file in directories" feature. 😃

@shundhammer
Copy link
Owner Author

I hope this commit fixes this for good. One is for Git master, the other for the stable-1.4 branch that I just added.

Distro maintainers: For the time being, please package 68904e1 as a patch on top of the QDirStat 1.4 tarball.

I hope there will be a new release soon; not sure if it warrants an 1.5 release or just an 1.4.1 release. One way or the other, this patch will be included.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant