public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
To: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	"Rafael J. Wysocki" <rjw@sisk.pl>, Ray Lee <ray-lk@madrabbit.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH] kdesu broken
Date: Tue, 28 Jul 2009 04:28:59 +0900	[thread overview]
Message-ID: <87skgikjr8.fsf@devron.myhome.or.jp> (raw)
In-Reply-To: <20090727171213.GB4233@skywalker> (Aneesh Kumar K. V.'s message of "Mon, 27 Jul 2009 22:42:14 +0530")

"Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com> writes:

> On Mon, Jul 27, 2009 at 05:42:52PM +0100, Alan Cox wrote:
>> 
>> > > -			if (count > tty->receive_room) {
>> > > +			if (count > tty->receive_room)
>> > >  				count = tty->receive_room;
>> > > -				done = 0;
>> > > -			}
>> > >  			char_buf = head->char_buf_ptr + head->read;
>> > >  			flag_buf = head->flag_buf_ptr + head->read;
>> > >  			head->read += count;
>> > > _
>> > 
>> > 
>> > I still have the "compile in emacs" bug. So this patch along with
>> > http://article.gmane.org/gmane.linux.kernel/869824 doesn't fix the
>> > bug for me.
>> 
>> Can you stick some printk calls in and debug it further then because at
>> with the fixes Ogawa provided I'm finding it impossible to reproduce even
>> on an 8 way x86.
>> 
>> What hardware are you using ?
>
> My T60p lenovo laptop. If you can send me a debug prink patch i can redo the
> test with the patches. I don't know what data i should start collecting so
> that it make sense. This is the patch i tried

If I read that part of emacs correctly, it seems to be assuming the data
was already sent to master side if the child process was exited.

And if it's right, unfortunately, I guess we can't return -EAGAIN in
this case to preserve behavior.

Aneesh, can you get the log of strace of emacs error case?

Thanks.
-- 
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>

#define _GNU_SOURCE
#define BIG_BUF
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <error.h>
#include <limits.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <sys/wait.h>
#include <unistd.h>

static char pts_name[PATH_MAX];

static int open_pty(void)
{
	int master;
	char *name;

	master = getpt();
	if (master < 0)
		return -1;

	if (grantpt(master) < 0 || unlockpt(master) < 0)
		goto close_master;

	{
		int on = 1;
		ioctl(master, FIONBIO, &on);
	}

	name = ptsname(master);
	if (name == NULL)
		goto close_master;

	strcpy(pts_name, name);

	return master;

close_master:
	close(master);
	return -1;
}

static pid_t child(int master)
{
	pid_t pid;
	int slave;

	pid = fork();
	if (pid < 0)
		error(1, errno, "%s: fork", __func__);

	if (pid == 0) {
		slave = open(pts_name, O_RDWR);
		if (slave < 0)
			error(1, errno, "%s: open", __func__);

		close(master);
		dup2(slave, 0);
		dup2(slave, 1);
		dup2(slave, 2);
		close(slave);

#ifdef BIG_BUF
	{
		char buf[4096];
		size_t size;

		memset(buf, '-', sizeof(buf));
		size = 0;
		while (size < 8192) {
			ssize_t r = write(STDOUT_FILENO, buf, sizeof(buf));
			if (r < 0)
				error(1, errno, "%s: write", __func__);
			size += r;
		}
	}
#else
		printf("1-----------------------------------------------\n");
		printf("2-----------------------------------------------\n");
		printf("3-----------------------------------------------\n");
		printf("4-----------------------------------------------\n");
		printf("5-----------------------------------------------\n");
		printf("6-----------------------------------------------\n");
		printf("7-----------------------------------------------\n");
		printf("8-----------------------------------------------\n");
		printf("9-----------------------------------------------\n");
#endif
		exit(0);
	}

	return pid;
}

int main()
{
	pid_t pid;
	int master;

	master = open_pty();
	if (master < 0)
		error(1, errno, "%s: open_pty", __func__);

	pid = child(master);

	waitpid(pid, NULL, 0);
	while (1) {
		char buf[4096];
		ssize_t size;

		size = read(master, buf, sizeof(buf));
		if (size < 0) {
			if (errno == EAGAIN) {
				printf("some app doesn't expect EAGAIN\n");
				break;
			}
			error(1, errno, "%s: read", __func__);
		}
		if (size == 0)
			break;
#ifdef BIG_BUF
		printf("size %zd\n", size);
#else
		write(STDOUT_FILENO, buf, size);
#endif
	}
	
	return 0;
}

  reply	other threads:[~2009-07-27 19:51 UTC|newest]

Thread overview: 104+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-23 23:45 [Regression] kdesu broken Rafael J. Wysocki
2009-07-24  0:21 ` Ray Lee
2009-07-24 15:21   ` Rafael J. Wysocki
2009-07-24 15:40     ` Alan Cox
2009-07-24 16:34       ` Linus Torvalds
2009-07-25  6:04         ` OGAWA Hirofumi
2009-07-25 13:31           ` Alan Cox
2009-07-25 14:05           ` Alan Cox
2009-07-25 14:55             ` OGAWA Hirofumi
2009-07-25 15:32               ` Alan Cox
2009-07-26 11:51                 ` OGAWA Hirofumi
2009-07-27 10:57                   ` Alan Cox
2009-07-27 12:07                     ` OGAWA Hirofumi
2009-07-27 12:46                       ` OGAWA Hirofumi
2009-07-27 13:23                       ` [PATCH] " Alan Cox
2009-07-27 13:50                         ` OGAWA Hirofumi
2009-07-27 13:58                           ` Alan Cox
2009-07-27 15:04                             ` OGAWA Hirofumi
2009-07-27 16:14                               ` Aneesh Kumar K.V
2009-07-27 16:42                                 ` Alan Cox
2009-07-27 17:12                                   ` Aneesh Kumar K.V
2009-07-27 19:28                                     ` OGAWA Hirofumi [this message]
2009-07-27 19:40                                       ` Linus Torvalds
2009-07-27 20:38                                         ` OGAWA Hirofumi
2009-07-27 20:45                                           ` Linus Torvalds
2009-07-27 21:42                                           ` Alan Cox
2009-07-27 22:04                                             ` Linus Torvalds
2009-07-27 22:41                                               ` Alan Cox
2009-07-27 20:52                                         ` Alan Cox
2009-07-27 21:22                                           ` Linus Torvalds
2009-07-27 21:54                                             ` Alan Cox
2009-07-27 21:20                                       ` Alan Cox
2009-07-28  5:33                                         ` OGAWA Hirofumi
2009-07-28 10:22                                           ` Alan Cox
2009-07-28 10:42                                             ` OGAWA Hirofumi
2009-07-28 15:49                                             ` Linus Torvalds
2009-07-28 16:42                                               ` Alan Cox
2009-07-28 16:49                                                 ` Linus Torvalds
2009-07-28 16:52                                                   ` Linus Torvalds
2009-07-28 17:09                                                     ` Alan Cox
2009-07-28 18:45                                                       ` Linus Torvalds
2009-07-28 17:06                                                   ` Alan Cox
2009-07-28 18:44                                                     ` Linus Torvalds
2009-07-28 18:56                                                       ` Alan Cox
2009-07-28 19:08                                                         ` Linus Torvalds
2009-07-28 19:15                                                           ` Alan Cox
2009-07-28 19:56                                                             ` Greg KH
2009-07-28 20:47                                                               ` Theodore Tso
2009-07-28 21:01                                                                 ` Greg KH
2009-07-28 22:02                                                                   ` Theodore Tso
2009-07-28 23:49                                                                     ` Alan Cox
2009-07-29  0:12                                                                       ` Greg KH
2009-07-30 23:16                                                                       ` Alan Cox
2009-07-30 23:24                                                                         ` Greg KH
2009-07-31 13:49                                                                       ` Alan Cox
2009-07-31 14:17                                                                         ` Greg KH
2009-07-28 23:46                                                           ` Alan Cox
2009-07-29  0:10                                                             ` Linus Torvalds
2009-07-29  0:26                                                               ` Linus Torvalds
2009-07-29  7:01                                                                 ` Aneesh Kumar K.V
2009-07-29  0:34                                                               ` Alan Cox
2009-07-29  1:04                                                                 ` Linus Torvalds
2009-07-29  1:23                                                                   ` Linus Torvalds
2009-07-29 11:17                                                                     ` Alan Cox
2009-07-29  8:59                                                                   ` Alan Cox
2009-07-29 15:48                                                                     ` Linus Torvalds
2009-07-29 15:55                                                                       ` Alan Cox
2009-07-29 16:05                                                                         ` Linus Torvalds
2009-07-29 16:39                                                                           ` Alan Cox
2009-07-29 19:07                                                                             ` Linus Torvalds
2009-07-29  2:50                                                               ` Gene Heskett
2009-07-29  4:49                                                                 ` Linus Torvalds
2009-07-29  4:54                                                                   ` Linus Torvalds
2009-07-29  5:04                                                                     ` Gene Heskett
2009-07-29  5:00                                                                   ` Gene Heskett
2009-07-29  5:08                                                                     ` Andrew Morton
2009-07-29  7:46                                                                       ` Gene Heskett
2009-07-29 11:07                                                                   ` Alan Cox
2009-07-29 17:40                                                                     ` Gene Heskett
2009-07-29 18:28                                                                       ` Frans Pop
2009-07-29 18:43                                                                         ` Gene Heskett
2009-07-29 19:08                                                                           ` Frans Pop
2009-07-29 19:19                                                                             ` Gene Heskett
2009-07-30 12:43                                                                               ` Valdis.Kletnieks
2009-07-30 15:35                                                                                 ` Gene Heskett
2009-07-30 18:39                                                                                   ` Valdis.Kletnieks
2009-07-31  2:01                                                                                   ` H. Peter Anvin
2009-07-28 15:48                                           ` Linus Torvalds
2009-07-28 16:16                                             ` OGAWA Hirofumi
2009-07-27 18:28                                 ` Andreas Schwab
2009-07-27 13:58                         ` Aneesh Kumar K.V
2009-07-25 20:12             ` [Regression] " Rafael J. Wysocki
2009-07-26 17:41             ` Aneesh Kumar K.V
2009-07-29  2:20             ` Gene Heskett
2009-07-25 11:48         ` Alan Cox
2009-07-25 14:02           ` Frans Pop
2009-07-25 20:16             ` Rafael J. Wysocki
2009-07-25 21:03               ` Alan Cox
2009-07-26 15:51             ` Sergey Senozhatsky
2009-07-24 18:25   ` Aneesh Kumar K.V
2009-07-25 12:07     ` Alan Cox
2009-07-25 16:18       ` Aneesh Kumar K.V
2009-07-25 17:06         ` Aneesh Kumar K.V
2009-07-29 19:09     ` [Regression] kdesu broken, now usb fixed in current git pull Gene Heskett

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87skgikjr8.fsf@devron.myhome.or.jp \
    --to=hirofumi@mail.parknet.co.jp \
    --cc=akpm@linux-foundation.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=aneesh.kumar@linux.vnet.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ray-lk@madrabbit.org \
    --cc=rjw@sisk.pl \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox