Bug 374600

Summary: KStandardDirs::locateLocal aborts with type="tmp"
Product: [Unmaintained] ksnapshot Reporter: sohel parvez <sajan.ebl>
Component: generalAssignee: Aaron J. Seigo <aseigo>
Status: RESOLVED UNMAINTAINED    
Severity: crash CC: kdelibs-bugs-null, mpyne, rthomsen6, sajan.ebl
Priority: NOR    
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description sohel parvez 2017-01-05 17:09:30 UTC
+++ This bug was initially created as a clone of Bug #328180 +++

Relevant backtrace:
#6  0x00007f5ff90991e5 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
#7  0x00007f5ff909c398 in __GI_abort () at abort.c:90
#8  0x00007f5ff9cc3402 in qt_message_fatal (context=..., message=...) at global/qlogging.cpp:979
#9  0x00007f5ff9cc0fce in QMessageLogger::fatal (this=0x7fff306f5de0, msg=0x7f6000893a90 "KStandardDirs: The resource type %s is not registered") at global/qlogging.cpp:384
#10 0x00007f6000767ca6 in KStandardDirs::saveLocation (this=0x1a8f0b0, type=0x4245dd "tmp", suffix=..., create=true) at /home/martin/src/kf5/kdelibs-frameworks/tier4/kde4support/src/kdecore/kstandarddirs.cpp:1565
#11 0x00007f600076ad1c in KStandardDirs::locateLocal (type=0x4245dd "tmp", filename=..., createDir=true) at /home/martin/src/kf5/kdelibs-frameworks/tier4/kde4support/src/kdecore/kstandarddirs.cpp:2132
#12 0x00007f600076ac48 in KStandardDirs::locateLocal (type=0x4245dd "tmp", filename=...) at /home/martin/src/kf5/kdelibs-frameworks/tier4/kde4support/src/kdecore/kstandarddirs.cpp:2122

Reproducible: Always

Steps to Reproduce:
Use code like:
KStandardDirs::locateLocal("tmp", filename.fileName())
Actual Results:  
crash

Expected Results:  
get a filename

This happened with KSnapshot ported to frameworks.
Comment 1 Michael Pyne 2017-01-06 02:03:25 UTC
The locateLocal("tmp",...) call needs to be ported to use QDir::tempPath() as described at https://community.kde.org/Frameworks/Porting_Notes/KStandardDirs

I seem to remember there was some discussion about replacing ksnapshot with spectacle as well, though I'm not sure what happened with that.
Comment 2 Christoph Feck 2017-01-10 00:03:48 UTC
KSnapshot has no official frameworks port. It was indeed replaced by the Spectacle application.