Bug 152805

Summary: "switch user" does not list sessions
Product: [Plasma] krunner Reporter: Edwin Schepers <yez>
Component: generalAssignee: Plasma Bugs List <plasma-bugs>
Status: RESOLVED FIXED    
Severity: major CC: amantia, crazy, facorread, jellenelis, jlp, kde-maintainers, marcus, stephaneguedon, sven.burmeister, t.powa, zander
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Edwin Schepers 2007-11-23 22:39:24 UTC
Version:           unknown (using KDE 3.96.1 (KDE 4.0 >= 20071120), compiled sources)
Compiler:          gcc
OS:                Linux (x86_64) release 2.6.22-5-default

Hi,
When I select Leave->"Switch User" from the K-menu, The window to run a command ( as with alt-f2) appears.

Regards,
Edwin
Comment 1 Jeffrey LaLone 2007-12-04 06:24:18 UTC
Yep, same here, using build 3.96.2-8.3 (from the openSUSE Build Service) on openSUSE 10.3
Comment 2 Pino Toscano 2007-12-06 11:56:07 UTC
*** Bug 153547 has been marked as a duplicate of this bug. ***
Comment 3 Christoph Watzl 2007-12-09 12:50:26 UTC
Same here; built this morning with kdesvn-build.
Comment 4 jamese 2007-12-16 02:04:23 UTC
I can confirm this with Kubuntu/7.10 packages for KDE3.97.
Comment 5 Thomas Zander 2007-12-17 16:26:30 UTC
Lets up the severity; I think this functionality is basic enough to warrent it.
Comment 6 Jason Stubbs 2007-12-21 13:21:00 UTC
Where does the responsibility for handling this lie? With Kickoff?
Comment 7 Sebastian Sauer 2007-12-21 21:34:58 UTC
The relevant code that handles it is within http://websvn.kde.org/trunk/KDE/kdebase/workspace/plasma/applets/kickoff/core/itemhandlers.cpp?view=markup at the LeaveItemHandler::switchUser() method.
Comment 8 Sebastian Sauer 2007-12-21 21:41:37 UTC
...and it calls in http://websvn.kde.org/trunk/KDE/kdebase/workspace/krunner/interface.cpp?view=markup the Interface::switchUser() method :)
Comment 9 Aaron J. Seigo 2007-12-21 22:20:51 UTC
here's the idea:

krunner should show a list of the existing sessions. that's why there is a SessionRunner. apparently this either (a) never worked properly or (b) got broken since i first put that support in there.

so look for special casing of the Sessions runner in krunner.
Comment 10 Sebastian Sauer 2007-12-22 01:53:25 UTC
Seems in SessionRunner::match(Plasma::SearchContext *search) the
dm.localSessions(sessions) condition always fails here (KDE3 kdm).

Reason is, that the DM::localSessions( SessList &list ) function in http://websvn.kde.org/trunk/KDE/kdebase/workspace/libs/kworkspace/dmctl.cpp?view=markup 
does always return false on exec at the

if (!exec( "list\talllocal\n", re ))
    return false;

Comment 11 Sebastian Sauer 2008-01-01 22:57:46 UTC
The console output indicates that it's phonon/knotify that crashes;

ksmserver(12056)/kdeui (KNotification) KNotificationManager::notificationClosed: 6
ksmserver(12056) KSMServer::logoutSoundFinished: Logout event finished
ksmserver(12056) KSMServer::startKilling: Starting killing clients
ksmserver(12056) KSMServer::startKilling: completeShutdown: client  "kwinsmhelper" ( 10cd617274000119922427000000120560000 )
ksmserver(12056) KSMServer::startKilling: completeShutdown: client  "knotify4" ( 10cd617274000119922427100000120560001 )
ksmserver(12056) KSMServer::startKilling: completeShutdown: client  "krunner" ( 10cd617274000119922427100000120560002 )
ksmserver(12056) KSMServer::startKilling: completeShutdown: client  "plasma" ( 10cd617274000119922427100000120560003 )
ksmserver(12056) KSMServer::startKilling: completeShutdown: client  "klipper" ( 10cd617274000119922427300000120560004 )
ksmserver(12056) KSMServer::startKilling: completeShutdown: client  "kaccess" ( 10cd617274000119922427300000120560005 )
ksmserver(12056) KSMServer::startKilling:  We killed all clients. We have now clients.count()= 7
ksmserver(12056) KSMServer::completeKilling: KSMServer::completeKilling clients.count()= 7
ksmserver(12056)/kdeui (KNotification) KNotification::~KNotification: 6
knotify(12064)/phonon (xine backend) Phonon::Xine::XineEngine::~XineEngine: delete Phonon::Xine::AudioPortDeleter
knotify(12064)/phonon (xine backend) Phonon::Xine::XineEngine::~XineEngine: delete QObject
ksmserver(12056) KSMServer::completeKilling: KSMServer::completeKilling clients.count()= 6
ksmserver(12056) KSMServer::completeKilling: KSMServer::completeKilling clients.count()= 5
knotify(12064)/phonon (xine backend) Phonon::Xine::XineEngine::xineEventListener: XINE_EVENT_QUIT
knotify(12064)/phonon (xine backend) Phonon::Xine::XineEngine::xineEventListener: XINE_EVENT_QUIT
plasma(12067)/kio (KDirLister) KDirLister::stop:
plasma(12067)/kio (KDirListerCache) KDirListerCache::forgetDirs: KDirLister(0x779da8)  item moved into cache:  KUrl("file:///home/kde4/Desktop")
ksmserver(12056) KSMServer::completeKilling: KSMServer::completeKilling clients.count()= 4
ksmserver(12056) KSMServer::completeKilling: KSMServer::completeKilling clients.count()= 3
plasma(12067) Plasma::LayoutItem::setLayout: layout removed from under us. expect crashes
plasma(12067) Plasma::LayoutItem::setLayout: layout removed from under us. expect crashes
plasma(12067) Plasma::LayoutItem::setLayout: layout removed from under us. expect crashes
plasma(12067) Plasma::LayoutItem::setLayout: layout removed from under us. expect crashes
plasma(12067) Plasma::LayoutItem::setLayout: layout removed from under us. expect crashes
plasma(12067)/kio (KDirListerCache) KDirListerCache::~KDirListerCache: -KDirListerCache
ksmserver(12056) KSMServer::completeKilling: KSMServer::completeKilling clients.count()= 2
knotify(12064)/phonon (xine backend) Phonon::Xine::AudioPortData::~AudioPortData: ----------------------------------------------- audio_port destroyed
knotify(12064)/phonon (xine backend) Phonon::Xine::XineEngine::~XineEngine: delete Phonon::Xine::AudioPortDeleter
knotify(12064)/phonon (xine backend) Phonon::Xine::XineEngine::~XineEngine: delete QObject
KCrash: crashing... crashRecursionCounter = 2
KCrash: Application Name = knotify4 path = <unknown> pid = 12064
sock_file=/home/kde4/.kde4/socket-earth/kdeinit4__3

Interesting here that we have 2 times "Phonon::Xine::XineEngine::~XineEngine" ... seems here to disable the sound for the logout-notification fixes the crash.
Comment 12 Sebastian Sauer 2008-01-01 22:58:34 UTC
*uarg* sorry, my reply above was designed to land at another report.
Comment 13 Shawn Starr 2008-01-01 23:58:08 UTC
I can confirm this bug using the simplelauncher use from kickoff also.
Comment 14 Jonathan Thomas 2008-01-10 19:52:57 UTC
Still has stuck around in 4.0.0
Well that shouldn't surprise anyone, but yeah.
Comment 15 Jason Stubbs 2008-01-12 16:03:05 UTC
*** Bug 155463 has been marked as a duplicate of this bug. ***
Comment 16 Jeffrey LaLone 2008-01-15 00:09:02 UTC
Yep, like Jonathan Thomas said, the bug's still around.  I'm using a completely fresh install from the openSUSE Build Service, so I'm pretty sure it's code and not something on my machine messed up from countless upgrades (like my previous lack of keyboard shortcuts)
Comment 17 David 2008-01-17 21:07:46 UTC
Yep, the bug's still alive.
Comment 18 Chani 2008-01-21 09:41:53 UTC
what you wanted was the "add cc" field to the right... er, I don't know if you need bugzilla rights in order for it to show up. I'll add you.
Comment 19 S. Burmeister 2008-01-23 00:39:03 UTC
Could Calvin Mitchell please fix his mail or get removed from this bug?
Comment 20 Pino Toscano 2008-01-23 00:43:00 UTC
(Removing bouncing CC'ed.)
Comment 21 stephaneguedon 2008-01-23 10:40:29 UTC
I am not spammer or spam source !
Even if I have my own postfix server !

Thanks ...

Le mardi 22 janvier 2008 à 23:44 +0000, Calvin Mitchell a écrit :
[bugs.kde.org quoted mail]
Comment 22 Rastislav Krupanský 2008-01-24 10:57:59 UTC
i can confirm this issue in opneSUSE Aplha1 and KDE 4.0.0
Comment 23 S. Burmeister 2008-01-24 11:09:37 UTC
Please stop confirming! Everybody knows this feature is missing, there is no need to spam this report with "I can confirm".
Comment 24 Sebastian Sauer 2008-01-25 02:24:51 UTC
Uff, that problem is really a mess :-/

So, I got some steps future. I am running KDM from KDE3 and use an own kde4-account where I installed KDE4 under.

1. running "kdmctl" at the prompt of the kde4-user should provide a list of some stuff. If it says permission denied, like it did in my case, you may need to switch some permissions at "/var/run/xdmctl/dmctl-:0" or whatever directory kdmctl complains about (thanks goes to Ossi here for providing that hint at the KDE4 release-party :)
2. check what echo "$DM_CONTROL" says. In my case it was needed to "export DM_CONTROL=/var/run/xdmctl"

and now in kdebase/workspace/libs/kworkspace/dmctl.cpp in the DM::DM() ctor the

if (::connect( fd, (struct sockaddr *)&sa, sizeof(sa) ))

condition is true what results in fd = -1; beeing set what in turn means, that in the DM::localSessions() method the

if (!exec( "list alllocal\n", re ))

is true aka it fails to fetch the sessions :-/

So, question is now, why ::connect( fd, (struct sockaddr *)&sa, sizeof(sa)) fails here. I don't see any difference to http://websvn.kde.org/branches/KDE/3.5/kdebase/kdmlib/dmctl.cpp?view=markup
Comment 25 András Manţia 2008-02-02 12:01:35 UTC
Part of the problem is that KRunner resets its interface *completely* if the search term is empty. This is why the "Switch users" header appears and disappears after 200ms. 
A workaround (or the solution?) is to use
    display("SESSIONS");
instead of display() in krunner/interface.cpp:429. This makes sure the sessions are listed. Creating new sessions works, switching to existing one does not. I use kdm from KDE3 though, but IMO it should work there as well.

BTW, the search term must be "SESSIONS", otherwise the sessions will not be listed. And if you delete the sessions term, KRunner resets itself and the header is changed to the standard KRunner header...

Sincerely I find using KRunner for sessions switching a bad idea.
 
Comment 26 András Manţia 2008-02-02 12:06:47 UTC
Hehe:
void SessionRunner::exec(Plasma::SearchMatch * action)
{
    if (!action->data().toString().isEmpty()) {
        //TODO: implement session switching here!
        return;
    }
...
}
Comment 27 András Manţia 2008-02-02 12:53:10 UTC
SVN commit 769905 by amantia:

Make session switching work.
If there are no problems (and there should not be), I will backport.

BUG: 152805

 M  +2 -2      interface.cpp  
 M  +12 -1     runners/sessions/sessionrunner.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=769905
Comment 28 Christoph Watzl 2008-02-06 15:38:03 UTC
This bug seems to have returned in trunk! I just tried it out, and once again, "Switch User" just opens the KRunner dialog (without "SESSIONS" filled in).
Comment 29 András Manţia 2008-02-06 16:06:57 UTC
I just tested with trunk from ~3 hours ago, and it works. And there were 
no commits to krunner meantime.
Comment 30 Aaron J. Seigo 2008-02-06 21:24:28 UTC
> Sincerely I find using KRunner for sessions switching a bad idea.

all the problems you note are solely due to the UI not being completed. the plan is to have all vs single runner and editable vs fixed query. then all else goes away.

of course, one could also put the list of sessions in kickoff as well by using the runner to populate a page.
Comment 31 András Manţia 2008-02-06 22:09:18 UTC
> all the problems you note are solely due to the UI not being
> completed. the plan is to have all vs single runner and editable vs
> fixed query. then all else goes away.


In that case it makes more sense. :)

Now if I could find out why SESSIONS is not always kept a sa search 
term...
Comment 32 Dan Meltzer 2008-02-08 20:01:55 UTC
*** Bug 157451 has been marked as a duplicate of this bug. ***
Comment 33 András Manţia 2008-02-08 21:29:17 UTC
Aaron, I saw that runners were moved/changed in trunk. Do you plan to 
backport those changes to branch? If not, I'd like to backport the 
session switching part to branch, so 4.0.2 will have it.
Comment 34 Aaron J. Seigo 2008-02-08 21:57:24 UTC
@Andras: if you'd like to do the backport of the sessions runner (even just the .cpp file, doesn't need to be the whole "make it a plugin" bit) that would be great. it was already on my backporting TODO, but that's already a long list and i've got tons of other things to keep me happily occupied as it is ;)

anyways, let me know if you get to it and i'll just scratch it off my list with a little "I Love Andras" sticker next to it...
Comment 35 András Manţia 2008-02-09 10:52:22 UTC
Actually I was thinking of backporting only the session switching code. 
I don't think I'd dare to backport all the changes you done in trunk to 
the runners, because well, there would be a high risk of breaking 
something. :) But we'll see what I can do.
Comment 36 Aaron J. Seigo 2008-02-09 15:31:25 UTC
the changes in SessionsRunner::match are all seem safe enough.. but yes, backport whatever subset of changes you'd like to =)
Comment 37 András Manţia 2008-02-16 19:23:53 UTC
Am I getting old? I checked the commit messages and I *did* backport it on 4th of February, 4 days before writing comment #33. :)
I don't have time to help with the rest of the backport of therunners code, as I don't have a KDE 4.0 system running, just trunk, and I wouldn't dare to do the backport without actually checking that everything works as it should.
Comment 38 Aaron J. Seigo 2008-02-17 10:29:15 UTC
we're all getting older ... all the time ;)

if you need/want testing of 4.0 branch things, just let me know. i've set up a 4.0 checkout here.
Comment 39 András Manţia 2008-03-06 08:34:08 UTC
Let's reopen this as it is still buggy. If you log in, the feature will not work, "SESSIONS" appears and disappears. As soon as you restart krunner (killall krunner;krunner) it will work. This makes hard to debug it, because as soon as you make a change in krunner and you restart it, it will work...
Comment 40 András Manţia 2008-05-10 17:16:40 UTC
Just a note that it is still present in trunk.
Comment 41 Aaron J. Seigo 2008-07-10 07:54:25 UTC
SVN commit 830312 by aseigo:

fix session listing
BUG:152805


 M  +2 -0      krunner/interface.cpp  
 M  +2 -0      plasma/runners/sessions/sessionrunner.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=830312