After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 538344 - Anjuta hangs when program is executed in terminal
Anjuta hangs when program is executed in terminal
Status: RESOLVED FIXED
Product: vte
Classification: Core
Component: general
0.16.x
Other Linux
: Immediate blocker
: ---
Assigned To: VTE Maintainers
VTE Maintainers
: 538635 540161 545114 545544 549808 550051 570052 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2008-06-14 17:46 UTC by Carl-Anton Ingmarsson
Modified: 2009-03-09 11:51 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
fix (1.22 KB, patch)
2008-08-20 19:08 UTC, Sébastien Granjoux
committed Details | Review

Description Carl-Anton Ingmarsson 2008-06-14 17:46:57 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:
  • #0 read
    from /lib/libpthread.so.0
  • #1 vte_terminal_io_read
    at vte.c line 3638
  • #2 IA__g_main_context_dispatch
    at gmain.c line 2063
  • #3 g_main_context_iterate
    at gmain.c line 2696
  • #4 IA__g_main_loop_run
    at gmain.c line 2919
  • #5 IA__gtk_main
    at gtkmain.c line 1161
  • #6 main
    at main.c line 395

Comment 1 Sébastien Granjoux 2008-06-14 17:59:29 UTC
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.

Comment 2 Carl-Anton Ingmarsson 2008-06-14 18:14:20 UTC
All programs are executed fine but anjuta hangs if "Run in terminal" is checked.
Comment 3 Sébastien Granjoux 2008-06-14 19:14:18 UTC
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 ?
Comment 4 Carl-Anton Ingmarsson 2008-06-14 19:58:17 UTC
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.
Comment 5 Sébastien Granjoux 2008-06-20 19:02:01 UTC
*** Bug 538635 has been marked as a duplicate of this bug. ***
Comment 6 Sébastien Granjoux 2008-07-28 17:45:49 UTC
*** Bug 545114 has been marked as a duplicate of this bug. ***
Comment 7 Christian Persch 2008-07-28 17:51:21 UTC
Confirming based on the dups.
Comment 8 Arun Chaganty 2008-07-31 10:45:57 UTC
*** Bug 545544 has been marked as a duplicate of this bug. ***
Comment 9 Sébastien Granjoux 2008-08-15 19:14:05 UTC
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.
Comment 10 Sébastien Granjoux 2008-08-20 19:08:38 UTC
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.
Comment 11 Michael De Backer 2008-08-25 21:05:17 UTC
The patch works perfectly.

Thanks a lot for your work !
Comment 12 Christian Persch 2008-08-31 13:11:08 UTC
*** Bug 550051 has been marked as a duplicate of this bug. ***
Comment 13 Miloš Mandarić 2008-08-31 14:53:11 UTC
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.
Comment 14 Sébastien Granjoux 2008-08-31 17:40:10 UTC
(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.

Comment 15 Sébastien Granjoux 2008-08-31 17:41:23 UTC
Sorry, I have made a error on the last version number it is 0.16.14 instead of 0.16.4.
Comment 16 Johannes Schmid 2008-08-31 18:42:31 UTC
Ping libvte maintainers to include this in GNOME 2.24, please!
Comment 17 Chris Wilson 2008-09-01 11:17:48 UTC
Thank you Sébastien for your diligence in fixing this bug.
Commited r2090.
Comment 18 Christian Persch 2008-11-27 19:40:29 UTC
*** Bug 540161 has been marked as a duplicate of this bug. ***
Comment 19 Sébastien Granjoux 2009-02-01 09:47:39 UTC
*** Bug 570052 has been marked as a duplicate of this bug. ***
Comment 20 Tobias Mueller 2009-03-09 11:51:18 UTC
*** Bug 549808 has been marked as a duplicate of this bug. ***