From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Richard W.M. Jones" Subject: Another bug, in dup3 Date: Tue, 9 Oct 2012 10:15:21 +0100 Message-ID: <20121009091521.GM24071@rhmail.home.annexia.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii To: Al Viro , linux-fsdevel@vger.kernel.org, Jim Meyering , Linus Torvalds Return-path: Received: from mx1.redhat.com ([209.132.183.28]:5319 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754402Ab2JIJP1 (ORCPT ); Tue, 9 Oct 2012 05:15:27 -0400 Content-Disposition: inline Sender: linux-fsdevel-owner@vger.kernel.org List-ID: Al: A second problem we noticed from the gnulib test is that this assertion fails with the latest upstream kernel: /* Assigning to self is invalid. */ errno = 0; ASSERT (dup3 (fd, fd, o_flags) == -1); <--- fails ASSERT (errno == EINVAL); dup3 is not currently specified by POSIX, so technically it is fine for dup3 on Linux to do anything it likes. *However* the proposal for dup3 in POSIX: http://austingroupbugs.net/view.php?id=411 says: "The dup3( ) function shall be equivalent to the dup2( ) function if the flag argument is 0, except that it shall be an error if fildes is equal to fildes2." So it's probably a good idea for Linux not to regress here. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones virt-p2v converts physical machines to virtual machines. Boot with a live CD or over the network (PXE) and turn machines into Xen guests. http://et.redhat.com/~rjones/virt-p2v