Fix hang in kcm_useraccount
Review Request #105895 - Created Aug. 6, 2012 and discarded
When changing the user's full name, chfn may not necessarily produce any output. Since readLine blocks, the kcm may hang. This change checks if chfn exited without output, and if so, use that exit status.
Tested all combinations of password required and name change permitted, with success.
now i took the time to have a deep look at this stuff ... the kdesu code is sickening. it should be rewritten from scratch for KF5. anyway, i think you are approaching things from the wrong end. while readLine is blocking, it should still exit if the child process terminated. i hacked up something which appears to work: http://pastebin.ca/2179290 the whole code seemed rather arcane and fragile, so i simplified it "a bit" ...
Review request changed
Updated review diff with Oswald's work, with a further change so that the password is only asked for if required.
Revision 6 (+28 -65)
heh - nasty: you put the dialog invocation into the backend class. to be consistent, you'd need to put the error message boxes into that class as well, and thus kill all core/gui separation entirely. ^^ but you hit the nail exactly on the head: the kdesu framework needs to be callback-based instead of requiring a password a-priori. i think the most qt way to do that would be the class emitting a needAuthentication(qstring prompt) signal and awaiting a returnAuthentication(qstring pw) slot invocation in return. the alternative would be handler classes with virtual functions (see kgreeter.h somewhere in workspace). do you feel like doing it right (and thus providing a prototype for the new kdesu) or want to take the shortcut?