GNOME Bugzilla – Bug 538344
Anjuta hangs when program is executed in terminal
Last modified: 2009-03-09 11:51:18 UTC
Anjuta hangs when the run-plugin is used to execute a program with the "Run in terminal" option checked. The terminal-plugin works flawlessly. Stacktrace:
+ Trace 200436
On which program do you get this ? I have tried with one of the Anjuta sample, just printing Hello and I have not seen a problem. I have launched anjuta (a more complex program) and it's working too. Note that the program is not executed directly but is executed by anjuta_shell that end when you press Enter.
All programs are executed fine but anjuta hangs if "Run in terminal" is checked.
I don't get this here. After the program end, you should see "---------------------------------------------- Program exited successfully with errcode (0) Press the Enter key to close this terminal ..." Do you get this ? Which version of vte do you have (0.16.13 here) ? Which version of gtk do you have (2.12.9 here) ? Which version of glib do you have (2.16.2 here) ? Do you run on Linux 32 or 64 bits ?
The problem seems to lie in vte. I'm using trunk and have managed to narrow the problem down to commit 2041 in vte. The bug should probably be reassigned to vte.
*** Bug 538635 has been marked as a duplicate of this bug. ***
*** Bug 545114 has been marked as a duplicate of this bug. ***
Confirming based on the dups.
*** Bug 545544 has been marked as a duplicate of this bug. ***
This bug is really annoying for Anjuta. I have looked at it, I can confirm that it's due to the change 2041. Anjuta hangs probably because the following lines have been removed: /* Set the pty to be non-blocking. */ i = fcntl(terminal->pvt->pty_master, F_GETFL); if ((i & O_NONBLOCK) == 0) { fcntl(terminal->pvt->pty_master, F_SETFL, i | O_NONBLOCK); } Then, even if I added these line in the latest version, I get a segmentation fault in _vte_terminal_connect_pty_read. I seems to be due to the merge of pty_input and pty_output channel in one pty_channel. I will try to make a bit more investigation but I don't know this code.
Created attachment 117081 [details] [review] fix I have written a fix for this bug. There are several troubles: 1. The first one (Anjuta hangs) appears because Anjuta reuses the same terminal object for launching all programs. The second time a program is launched, terminal->pvt->pty_master is closed but not set to -1 in _vte_terminal_fork_basic. vte_terminal_set_pty returns at the beginning and don't set the pipe in non blocking mode. 2. After fixing this, I get a segmentation fault, because terminal->pvt->pty_channel is unreferenced but not set to NULL, in the same function. The old unreferenced channel is used in g_io_add_watch_full and crash the program. 3. After clicking in the terminal window, the pty_channel seems to be unreferenced but I still need to send a key press to the program. So, I have restored the old behavior of vte_terminal_connect_pty_write, that recreates a new channel if it is missing.
The patch works perfectly. Thanks a lot for your work !
*** Bug 550051 has been marked as a duplicate of this bug. ***
Strangely, I didn't have this bug with 0.16.13 version of Vte, only on 0.17.2 but this patch have fix it.
(In reply to comment #13) > Strangely, I didn't have this bug with 0.16.13 version of Vte, only on 0.17.2 > but this patch have fix it. It's normal. It was working with my setup having vte 0.16.13. In order to get the problem, I have compiled a more recent version of libvte from svn. The problem comes with revision 2041, so it is in vte 0.16.4 or higher.
Sorry, I have made a error on the last version number it is 0.16.14 instead of 0.16.4.
Ping libvte maintainers to include this in GNOME 2.24, please!
Thank you Sébastien for your diligence in fixing this bug. Commited r2090.
*** Bug 540161 has been marked as a duplicate of this bug. ***
*** Bug 570052 has been marked as a duplicate of this bug. ***
*** Bug 549808 has been marked as a duplicate of this bug. ***