Bug 82

Summary: Dismissing the dialog asking for sudo password breaks interaction
Product: [Yocto Project Subprojects] Anjuta Plugin Reporter: Joshua Lock - Disabled <josh>
Component: anjuta-pluginAssignee: Scott Garman <scott.a.garman>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: Medium CC: josh, liping.ke, richard.purdie, sgw, yongkang.you, yp.ap.watcher, yp.watcher
Version: 0.9   
Target Milestone: 0.9 M4   
Hardware: All   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Program Management Documentation change: ---

Description Joshua Lock - Disabled 2010-02-23 17:28:03 UTC
If a user dismisses the dialog box requesting the sudo password (triggered by Start QEMU menu entry) QEMU is not started but the UI is put in the ready state (Deploy, Shutdown QEMU, etc menus active).
Comment 1 Joshua Lock - Disabled 2010-04-16 15:17:40 UTC
To clarify, if the dialog box is dismissed (or the sudo password fails) we need the UI to be in a usable state.
Comment 2 liping Ke 2010-05-19 02:47:30 UTC
Hi, Jessica and Josh

This problem is much more complex than I originally thought.
After dig into poky sdk plugin, anjuta IDE as well as gnome related code, I think this might not be the problem of poky SDK plugin, but rather anjuta IDE limitation.

1)  In SDK, it register a callback g_signal_connect (priv->launcher, "child-exited", (GCallback)launcher_child_exited_cb, btq); When sudo qemu process exists, the menu will be  enable again. It’s good.
2)  When anjuta_launcher_execute_v to start qemu, two parent/son process is created: parent process run as lke /bin/bash, it will start son process as root sudo qemu. Then anjuta IDE will scan tty output. When output saw terminal tty output “password”, then password dialog appears. If we input password correctly, qemu launchers. Everything is fine. When qemu exited, the callback auncher_child_exited_cb will re-enable “start qemu” menu correctly. But if we click cancel, accident happens. In Anjuta plugin, it will do _reset ops. It did kill the parent process running as lke (bash), but the son process (sudo qemu) still there. Then the callback will never be called launcher_child_exited_cb, it listens the termination of root sudo qemu process. So “start qemu” button will never be re-enabled again. That’s the problem.

3) Actually Anjuta IDE is running as lke, it’s also not reasonable to make it kill this root sudo process unless you know the password (not cancelling), so this is the problem.
4) In fact I think this password dialog should not be yes/cancel model. Since when you do sudo in terminal, you have to input password and you never be able to “cancel”. After three times failure, the two process will all exist normally. Then  everything is fine. To emulate this terminal tty input, the password dialog should only have “input” model. If user did not input anything, let the dialog running. If user click close/cancel, it should be something like input empty “” just as tty terminal does. 

So I feel it’s actually not the bug of plugin, but rather Anjuta IDE. Your ideas?

Thanks& Regards,
criping
Comment 3 Joshua Lock - Disabled 2010-05-19 11:53:43 UTC
I'd suggest we file a bug with upstream explaining, in brief, our situation (with a link to this bug report) and open a discussion with them for a solution.
Comment 4 liping Ke 2010-05-20 03:29:10 UTC
work around for this:
If you really want to make this "cancel" work while anjuta IDE still has this limitation, please try:

adding a "sudo" line in poky-qemu bash script, make this script running as root before running qemu, so that passwork dialog cancel will only kill this process (qemu is not started).Everything will be fine.

As for Anjuta IDE limitation, I will fire a bug in anjuta bugzilla. The bug number will be written here after I successfully fire it.

For the bug itself, it will not be fixed. You can try the work around if needed.

Thanks& Regards,
criping
Comment 5 liping Ke 2010-05-20 03:41:13 UTC
For Anjuta IDE related bug status, please refer to https://bugzilla.gnome.org/show_bug.cgi?id=619156
Comment 6 Joshua Lock - Disabled 2010-05-20 11:30:05 UTC
I'm changing this resolution to later, I absolutely think it's something we should fix.

If the upstream isn't amenable to a fix we should implement the workaround, let's keep this bug open to track the issue.
Comment 7 Yongkang You 2010-07-05 22:45:30 UTC
We won't use resolve/later for track this bug. So just reopen this issue.
Comment 8 liping Ke 2010-07-13 22:43:43 UTC
upstream did not have response yet. we can work around it by simply add sudo in
poky-qemu last line like 

- . $INTERNALSCRIPT
+ sudo . $INTERNALSCRIPT

not knowing whether this could be done in M2...
Comment 9 liping Ke 2010-07-13 22:44:11 UTC
Just got latest feedback from Anjuta:

https://bugzilla.gnome.org/show_bug.cgi?id=619156
  anjuta | libanjuta | unspecified

--- Comment #5 from Johannes Schmid <jhs@gnome.org> 2010-06-29 08:50:16 UTC ---
Could you get around this problem somehow? I really don't see a way how to fix
that properly without giving the users annoying password dialogs when they
already cancelled things.
Comment 10 Joshua Lock - Disabled 2010-07-16 06:45:20 UTC
I'd like to get Richard's feedback on this change to the script. I don't think it would break anything but I'm not certain.
Comment 11 liping Ke 2010-09-01 00:23:47 UTC
Now it's runqemu-unfs. I am not sure in which point to add "sudo". But I think this is not a good fix from the point of security. Since anjuta is not our focus, I suggest marking this problem as "wont' fix".


Not sure whether it's acceptable.

Thanks& Regards,
criping
Comment 12 Jessica 2010-09-28 17:06:00 UTC
On Scott's qemu clean up task list, he'll create a script to setup tap device pool for qemu instance to bind with.  Once that's in place, we shouldn't need sudo for running poky-qemu
Comment 13 Scott Garman 2010-10-07 14:22:28 UTC
The tap device creation script is called poky-gen-tapdevs and is included as of commit 8532405c1d6b2184ca88922506b725110a1f7627. Also take note that poky-qemu has replaced runqemu as the Poky QEMU control script.
Comment 14 Joshua Lock - Disabled 2010-12-13 03:35:31 UTC
Verify this bug is fixed