[From nobody Sun Jul  5 16:40:50 2009
Return-Path: &lt;torvalds@osdl.org&gt;
X-Original-To: andrea@wotan.suse.de
Received: from hermes.suse.de (hermes.suse.de [149.44.160.1])
	by wotan.suse.de (Postfix) with ESMTP id 4B230224A6E
	for &lt;andrea@wotan.suse.de&gt;; Mon, 28 Feb 2005 20:21:20 +0100 (CET)
Received: by hermes.suse.de (Postfix)
	id 407641519D6; Mon, 28 Feb 2005 20:21:20 +0100 (CET)
Received: from scanhost.suse.de (scanhost.suse.de [149.44.160.36])
	by hermes.suse.de (Postfix) with ESMTP id 36DA7151A57
	for &lt;andrea@suse.de&gt;; Mon, 28 Feb 2005 20:21:20 +0100 (CET)
Received: from hermes.suse.de ([149.44.160.1])
	by scanhost.suse.de (scanhost [149.44.160.36]) (amavisd-new, port 10025)
	with ESMTP id 32391-20 for &lt;andrea@suse.de&gt;;
	Mon, 28 Feb 2005 20:21:08 +0100 (CET)
Received: from Cantor.suse.de (mail.suse.de [195.135.220.2])
	(using TLSv1 with cipher EDH-RSA-DES-CBC3-SHA (168/168 bits))
	(No client certificate requested)
	by hermes.suse.de (Postfix) with ESMTP id E97C81519D6
	for &lt;andrea@suse.de&gt;; Mon, 28 Feb 2005 20:21:08 +0100 (CET)
Received: from smtp.osdl.org (fire.osdl.org [65.172.181.4])
	(using TLSv1 with cipher EDH-RSA-DES-CBC3-SHA (168/168 bits))
	(No client certificate requested)
	by Cantor.suse.de (Postfix) with ESMTP id 6C34F152FB31
	for &lt;andrea@suse.de&gt;; Mon, 28 Feb 2005 20:21:08 +0100 (CET)
Received: from shell0.pdx.osdl.net (fw.osdl.org [65.172.181.6])
	by smtp.osdl.org (8.12.8/8.12.8) with ESMTP id j1SJL5qi009235
	(version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO);
	Mon, 28 Feb 2005 11:21:06 -0800
Received: from localhost (shell0.pdx.osdl.net [10.9.0.31])
	by shell0.pdx.osdl.net (8.13.1/8.11.6) with ESMTP id j1SJL4fS003152;
	Mon, 28 Feb 2005 11:21:05 -0800
Date: Mon, 28 Feb 2005 11:22:18 -0800 (PST)
From: Linus Torvalds &lt;torvalds@osdl.org&gt;
To: Andrea Arcangeli &lt;andrea@suse.de&gt;
Cc: Andrew Morton &lt;akpm@osdl.org&gt;, linux-kernel@vger.kernel.org
Subject: Re: two pipe bugfixes
In-Reply-To: &lt;20050228190437.GI8880@opteron.random&gt;
Message-ID: &lt;Pine.LNX.4.58.0502281113380.25732@ppc970.osdl.org&gt;
References: &lt;20050228042544.GA8742@opteron.random&gt;
	&lt;Pine.LNX.4.58.0502272143500.25732@ppc970.osdl.org&gt;
	&lt;20050228190437.GI8880@opteron.random&gt;
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
Received-SPF: pass (domain of torvalds@osdl.org designates 65.172.181.6 as
	permitted sender)
X-MIMEDefang-Filter: osdl$Revision: 1.103 $
X-Virus-Scanned: by amavisd-new at scanhost.suse.de
X-Spam-Checker-Version: SpamAssassin 3.0.0 (2004-09-13) on opteron.random
X-Spam-Level: 
X-Spam-Status: No, score=-2.8 required=5.0 tests=AWL,BAYES_00 autolearn=ham 
	version=3.0.0



On Mon, 28 Feb 2005, Andrea Arcangeli wrote:
&gt; 
&gt; &gt; [..] And python-twisted is just plain bogus.
&gt; 
&gt; What do you mean with this, could you elaborate? You mean it shouldn't
&gt; check for in/out set at the same time? I've no idea why it got confused
&gt; by out/in set at the same time, but I guess it could be some
&gt; compatibility thing with some other os.

I wonder. It migth just be a latent bug in python-twisted, rather than any 
&quot;designed behaviour&quot;.

&gt; Still my point is that such code should never trigger since pollin
&gt; should never be set for an output-pipe-fd.

Equally arguably, POLLERR should _always_ be set if you select a
write-only pipe for reading, and guess what? That would cause &quot;select()&quot;
to return readable. It's true too: select returns whether a read() would
return immediately, and it _would_ - with an error code.

The basic fact is that an application that asks whether the pipe that it
opened for writing is readable is doing something stupid, and the old
behaviour was at most surprising, but I'd argue it isn't really
necessarily a _bug_.

Of course, &quot;surprising&quot; is bad, even if it's not necessarily a bug. So 
making the return value be &quot;unsurprising&quot; can in any case be considered an 
improvement.

&gt; &gt; I don't agree with your patch, though - I don't like your lack of
&gt; &gt; parenthesis ;)
&gt; 
&gt; ;)

I ended up editing it a bit more: the other bits (POLLHUP and POLLERR)  
also really only make sense for only one side of the reader/writer
schenario, so logically they should be grouped the same way.

Of course, in those cases, you can't get the &quot;wrong&quot; answer anyway, since
those only trigger if there are no readers or no writers (and if you're
open as a reader, that in itself obviously guarantees that there _are_
readers, and POLLERR cannot happen according to either the old or the new
rules).

Anyway, I think I made the code look more logical while there.

		Linus
]