Skip to contentSkip to conversation

gnome-terminal acts funny in recent 2.5 series

DISCUSSION Alessandro Suardi 6 participants 7 messages Feb 19, 2002

lore
Share & tools
lore
#0 lore raw

Running Ximian-latest for rh72/i386, latest 2.5 kernels (including
2.5.4-pre2, 2.5.4, 2.5.5-pre1).

Symptom:
- clicking on the panel icon for gnome-terminal shows a flicker of the terminal window coming up then the window disappears. No leftover processes.

What works 100%:
- regular xterm in 2.5.x
- gnome-terminal in 2.4.x (x in .17, .18-pre9, .18-rc2)

More info:
- doesn't happen 100% of the time, but close
- trying to start gnome-terminal either vanilla or with the parameters in the icon from an xterm causes
* gnome-terminal window comes up, but no shell prompt; the window *does not* disappear and program is in a CPU loop
* program detaches from calling xterm even when '&' is not used
* calling xterm's tty is left in a funny state (sometimes stty sane^J is required, sometimes tput reset)

Any ideas would be quite welcome - I can go back and try and narrow
down what kernel breaks gnome-terminal if nothing comes up.

Thanks,

--alessandro

"If your heart is a flame burning brightly
you'll have light and you'll never be cold
And soon you will know that you just grow / You're not growing old"
(Husker Du, "Flexible Flyer")

#1 lore raw
Quoted 11 lines · On Tue, 19 Feb 2002 01:03:13 +0100 Alessandro Suardi…

Running Ximian-latest for rh72/i386, latest 2.5 kernels (including
2.5.4-pre2, 2.5.4, 2.5.5-pre1).

Symptom:
- clicking on the panel icon for gnome-terminal shows a flicker of the terminal window coming up then the window disappears. No leftover processes.

What works 100%:
- regular xterm in 2.5.x
- gnome-terminal in 2.4.x (x in .17, .18-pre9, .18-rc2)

I noticed this problem also... it seems the problem lies on devpts, I enabled it on my 2.5.5pre1 build, mounting devpts with the options given on the "readme" file made gnome-terminal start on the second try, almost everytime

[]s!

Signature · 7 lines
    Gustavo Noronha Silva - kov <http://www.metainfo.org/kov>
*---------* -+-+--+-+--+-+--+-+--+-+--+-+--+-+--+-+--+-+--+-+-+
|  .''`.  | Debian GNU/Linux: <http://www.debian.org>         |
| : :'  : + Debian BR.......: <http://debian-br.cipsga.org.br>+
| `. `'`  + Q: "Why did the chicken cross the road?"          +
|   `-    | A: "Upstream's decision." -- hmh                  |
*---------* -+-+--+-+--+-+--+-+--+-+--+-+--+-+--+-+--+-+--+-+-+
#2 lore raw
Quoted 5 lines · Gustavo

I noticed this problem also... it seems the problem lies on devpts, I enabled it on my 2.5.5pre1 build, mounting devpts with the options given on the "readme" file made gnome-terminal start on the second try, almost everytime

I also am seeing this problem--it is definitely pts related. I have noticed that when the problem occurs, if I execute "gnome-terminal &" from an existing gnome-terminal, a new window comes up, but input and output from the new shell are still going to the prior gnome-terminal. 'ps' shows both the new gnome-terminal and old gnome-terminal on the same pts. But sometimes everything works fine.

Cheers, Wayne

#3 lore raw
Quoted 8 lines · On Mon, 18 Feb 2002 20:00:51 -0800 Wayne Whitney <[email protected]>…
Quoted 5 lines · Gustavo

I noticed this problem also... it seems the problem lies on devpts, I enabled it on my 2.5.5pre1 build, mounting devpts with the options given on the "readme" file made gnome-terminal start on the second try, almost everytime

Quoted 8 lines

I also am seeing this problem--it is definitely pts related. I have noticed that when the problem occurs, if I execute "gnome-terminal &"

Quoted 1 line

from an existing gnome-terminal, a new window comes up, but input and

output from the new shell are still going to the prior gnome-terminal. 'ps' shows both the new gnome-terminal and old gnome-terminal on the same pts. But sometimes everything works fine.

Cheers, Wayne

Hi,
here are the outputs... maybe someone can understand it ;)
BTW: aterm, eterm and xterm are running without problems...

Bye

#4 lore raw
In reply to Gustavo Noronha Silva
Quoted 11 lines · On Mon, 18 Feb 2002 21:39:17 -0300 Gustavo Noronha Silva <[email protected]> wrote:
Quoted 8 lines · On Tue, 19 Feb 2002 01:03:13 +0100 Alessandro Suardi…

Running Ximian-latest for rh72/i386, latest 2.5 kernels (including
2.5.4-pre2, 2.5.4, 2.5.5-pre1).

Symptom:
- clicking on the panel icon for gnome-terminal shows a flicker of the terminal window coming up then the window disappears. No leftover processes.

Quoted 8 lines
Quoted 3 lines

What works 100%:
- regular xterm in 2.5.x
- gnome-terminal in 2.4.x (x in .17, .18-pre9, .18-rc2)

I noticed this problem also... it seems the problem lies on devpts, I enabled it on my 2.5.5pre1 build, mounting devpts with the options given on the "readme" file made gnome-terminal start on the second try, almost everytime

Hi,
I have the same problem here... I reported it in another thread (look at "Reiserfs Corruption in 2.5.5-pre1")
Maybe it's something with devpts but I enabled only devfs...
If you start the gnome-terminal from an xterm for example it starts but hangs before or shortly after loading bash
Sometimes gnome-terminal starts without problems but most trys it hangs
If you strace gnome-terminal you can see an endless loop doing some funny things (I have deleted the output but I'll post it later the day, including "ps axlwww" output)

Bye

#5 lore raw
In reply to Alessandro Suardi
Quoted 23 lines · Alessandro Suardi

Running Ximian-latest for rh72/i386, latest 2.5 kernels (including
2.5.4-pre2, 2.5.4, 2.5.5-pre1).

Symptom:
- clicking on the panel icon for gnome-terminal shows a flicker of the terminal window coming up then the window disappears. No leftover processes.

What works 100%:
- regular xterm in 2.5.x
- gnome-terminal in 2.4.x (x in .17, .18-pre9, .18-rc2)

More info:
- doesn't happen 100% of the time, but close
- trying to start gnome-terminal either vanilla or with the parameters in the icon from an xterm causes
* gnome-terminal window comes up, but no shell prompt; the window *does not* disappear and program is in a CPU loop
* program detaches from calling xterm even when '&' is not used
* calling xterm's tty is left in a funny state (sometimes stty sane^J is required, sometimes tput reset)

Quoted 2 lines

Any ideas would be quite welcome - I can go back and try and narrow
down what kernel breaks gnome-terminal if nothing comes up.

Probably, this problem had occurred in libzvt which gnome-terminal is using.

libzvt was using file descriptor passing via UNIX domain socket for pseudo terminal. Then because ->passcred was not initialized in sock_alloc(), unexpected credential data was passing to libzvt.

The following patch fixed this problem, but I'm not sure. Could you review the patch? (attached file are test program)

socket.c renamed from socket.c.orig +2 -0
@@ -501,6 +501,8 @@ struct socket *sock_alloc(void)
 	sock->ops = NULL;
 	sock->sk = NULL;
 	sock->file = NULL;
+//	init_waitqueue_head(&sock->wait);	this is needed?
+	sock->passcred = 0;
 
 	sockets_in_use[smp_processor_id()].counter++;
 	return sock;

Regards

Signature · 1 line
OGAWA Hirofumi <[email protected]>

#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/wait.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>

static void client(int fd)

{
	int send_fd;
	struct msghdr msg;
	struct iovec iov[1];
	char buf[1];
	union {
		struct cmsghdr cm;
		char cntl[CMSG_SPACE(sizeof(int))];
	} cntl_u;
	struct cmsghdr *cmsgptr;

	send_fd = open("/dev/null", O_RDWR);
	
	iov[0].iov_base = buf;
	iov[0].iov_len = 1;
	msg.msg_iov = iov;
	msg.msg_iovlen = 1;
	msg.msg_name = NULL;
	msg.msg_namelen = 0;

	msg.msg_control = cntl_u.cntl;
	msg.msg_controllen = sizeof(cntl_u.cntl);

	cmsgptr = CMSG_FIRSTHDR(&msg);
	cmsgptr->cmsg_len = CMSG_LEN(sizeof(int));
	cmsgptr->cmsg_level = SOL_SOCKET;
	cmsgptr->cmsg_type = SCM_RIGHTS;
	*((int *)CMSG_DATA(cmsgptr)) = send_fd;

	if (sendmsg(fd, &msg, 0) <= 0)
		perror("sendmsg");
}

static void server(int fd)

{
	int recv_fd;
	struct stat statbuf;
	struct msghdr msg;
	struct iovec iov[1];
	char buf[1];
	union {
		struct cmsghdr cm;
		char cntl[CMSG_SPACE(sizeof(int))];
	} cntl_u;
	struct cmsghdr *cmsgptr;

	iov[0].iov_base = buf;
	iov[0].iov_len = 1;
	msg.msg_iov = iov;
	msg.msg_iovlen = 1;
	msg.msg_name = NULL;
	msg.msg_namelen = 0;

	msg.msg_control = cntl_u.cntl;
	msg.msg_controllen = sizeof(cntl_u.cntl);
	
	if (recvmsg(fd, &msg, 0) <= 0) {
		perror("recvmsg");
		exit(1);
	}
	cmsgptr = CMSG_FIRSTHDR(&msg);
	if (cmsgptr == NULL) {
		fprintf(stderr, "no control message\n");
		exit(1);
	}
	if (cmsgptr->cmsg_len != CMSG_LEN(sizeof(int)))
		fprintf(stderr, "bad length: %d\n", cmsgptr->cmsg_len);
	if (cmsgptr->cmsg_level != SOL_SOCKET)
		fprintf(stderr, "not SOL_SOCKET: %d\n", cmsgptr->cmsg_level);
	if (cmsgptr->cmsg_type != SCM_RIGHTS)
		fprintf(stderr, "not SCM_RIGHTS: %d\n", cmsgptr->cmsg_type);
	recv_fd = *((int *)CMSG_DATA(cmsgptr));
	if (fstat(recv_fd, &statbuf) == -1) {
		perror("stat");
		exit(1);
	}

	printf("fd: %d, dev: %llx, mode: %o\n",
	       recv_fd, statbuf.st_rdev, statbuf.st_mode);
}

int main()

{
	pid_t pid;
	int status, fd[2];

	if (socketpair(AF_UNIX, SOCK_STREAM, 0, fd) == -1) {
		perror("socketpair");
		exit(1);
	}

	pid = fork();
	if (pid == -1) {
		perror("fork");
		exit(1);
	}
	if (pid == 0) {
		close(fd[1]);
		client(fd[0]);
		exit(0);
	}

	close(fd[0]);
	if (waitpid(pid, &status, 0) != pid) {
		perror("waitpid");
		exit(1);
	}
	if (!WIFEXITED(status) || WEXITSTATUS(status) != 0) {
		fprintf(stderr, "client abnormal end\n");
		exit(1);
	}

	server(fd[1]);

	return 0;
}
#6 lore raw
In reply to Alessandro Suardi

socket.c struct socket *sock_alloc(void) · line 505

Quoted 8 lines · OGAWA Hirofumi
socket.c renamed from socket.c.orig +2 -0
@@ -501,6 +501,8 @@ struct socket *sock_alloc(void)
 	sock->ops = NULL;
 	sock->sk = NULL;
 	sock->file = NULL;
+//	init_waitqueue_head(&sock->wait);	this is needed?
+	sock->passcred = 0;

The first line is dead since 2.5.4, but the second is the important bit here. And as well as fixing the gnome-terminal weirdness, it also fixes the 'portmapper slows box to a crawl' problem, that Zwane, myself and rth saw..

Signature · 2 lines
| Dave Jones.        http://www.codemonkey.org.uk
| SuSE Labs