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 622478 - Anjuta vte plugin fails if vte_terminal_fork_command fails
Anjuta vte plugin fails if vte_terminal_fork_command fails
Status: RESOLVED INVALID
Product: vte
Classification: Core
Component: general
0.25.x
Other Windows
: Normal normal
: ---
Assigned To: VTE Maintainers
VTE Maintainers
Depends on:
Blocks:
 
 
Reported: 2010-06-23 09:47 UTC by liping Ke
Modified: 2010-06-25 05:59 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description liping Ke 2010-06-23 09:47:51 UTC
Hi, all
Anjuta is now using vte as its terminal plugin. But when calling 
ianjuta_terminal_execute_command, if the command execution fails, the launched vte terminal will enter an keyboard/mouse unresponse state. If I tried to go on with executing the second/third valid command, the terminal will be bring back.
I guess it is because when executing invalid command, the vte termial got no
output stream and be blocked in reading?

Anyway, If the command execution fails, we'd better print the error information on the terminal, instead of being UI un-responsive, is it?

related anjuta bugzilla link 
https://bugzilla.gnome.org/show_bug.cgi?id=619253

Thanks a lot for your help!
criping
Comment 1 Christian Persch 2010-06-23 11:16:25 UTC
Can you elaborate on what you mean by 'unresponsive'? If you mean that if executing the command fails, the terminal just does nothing, that's expected and not a bug. If on the other hand it means that vte hangs the containing programme, or consumes CPU, then that would be a bug.

Also, what's the exact error returned? Use vte_terminal_fork_command_full() and pass it a non-NULL GError.

Got a link to the anjuta code that's doing this?
Comment 2 liping Ke 2010-06-24 01:36:02 UTC
(In reply to comment #1)
> Can you elaborate on what you mean by 'unresponsive'? If you mean that if
> executing the command fails, the terminal just does nothing, that's expected
> and not a bug. If on the other hand it means that vte hangs the containing
> programme, or consumes CPU, then that would be a bug.
> 
> Also, what's the exact error returned? Use vte_terminal_fork_command_full() and
> pass it a non-NULL GError.
> 
> Got a link to the anjuta code that's doing this?

Hi,
Thanks a lot for help!

Unresponsive means the terminal has no output and no command prompt. It is blank. User can't input anything on the terminal too.
So terminal is there yet we could do nothing with it.

I ran into this problem in anjuta2.28 and anjuta 2.30 is the same. We call anjuta/plugins/terminal/terminal.c->terminal_execute to call local cross gdb. But if local cross gdb does not exsit, we'll ran into above problem. We thought better behavior would be the terminal with command prompt there, and even give some error message. 

I saw terminal_execute will call vte_terminal_fork_command and get chile_pid. I remember I did some tests before. If fails, the Child_pid will be -1? Yet I don't know how to deal with vte unresponsive problem.

I think vte is not dead of course. Because if a call terminal_execute again for a "pwd", it will becomes just good again.

I report this problem to anjuta team, but they said I should report here.

Are above behavior the expected behavior for the vte?

paster anjuta code http://git.gnome.org/browse/anjuta/tree/plugins/terminal/terminal.c line 415 for your ref.

Thanks& Regards,
criping
Comment 3 Christian Persch 2010-06-24 11:29:48 UTC
A few code comments:

	term_plugin->child_pid = vte_terminal_fork_command (term, args[0], args,
														environment, dir,
	    												term_plugin->lastlog,
	    												term_plugin->update_records,
	    												term_plugin->update_records);
	vte_reaper_add_child (term_plugin->child_pid);

Missing error check before vte_reaper_add_child, which is redundant anyway since vte_terminal_fork_command does that internally already.

	vte_terminal_fork_command (term, shell, NULL, NULL, dir,
								term_plugin->lastlog,
								term_plugin->update_records,
								term_plugin->update_records);
}

No error check whatsoever.

---

This is all as expected. If launching the command fails (fork_command returns -1, or fork_command_full returns FALSE), then the terminal has no input and no output, since nothing is running on it.
Comment 4 liping Ke 2010-06-25 03:28:53 UTC
Hi, thanks for point it out. Yes, I also found the problem and made a patch for it. But that didn't help just as you said that terminal has no input and output. So user just can't do operations on the terminal. Just a quick question here: if execution fails, could it be possible to write a "\n" or did any other things to the terminal so that terminal could be brought back? So that user experiences might be good.

we also find if we execute local gdb. The gdb first output (lots of version informations, etc) will be messed up in 2.30 anjuta. We'll try to identify the reason of vte terminal output and give details here.

Thanks  a lot for your help!
criping
Comment 5 Behdad Esfahbod 2010-06-25 04:20:15 UTC
If fork fails, you can try forking a shell.  It's up to you to tell vte what to do next.
Comment 6 liping Ke 2010-06-25 05:59:14 UTC
(In reply to comment #5)
> If fork fails, you can try forking a shell.  It's up to you to tell vte what to
> do next.

Thanks for the information. I will turn back to anjuta plugin community to solve the problem.