Description of problem: 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. (Thanks Jim Meyering for finding the link) Version-Release number of selected component (if applicable): 3.7.0-0.rc0.git2.4.fc19.x86_64 How reproducible: 100%
Upstream bug report: http://marc.info/?l=linux-fsdevel&m=134977414011004&w=2
Created attachment 624011 [details] dup3.c (test case) Test case. $ gcc /tmp/dup3.c -o /tmp/dup3 $ /tmp/dup3 dup3 (fd, fd, 0) didn't fail!
This patch was apparently accepted upstream: http://marc.info/?l=linux-fsdevel&m=134979287120445&w=2