X-Recipient: archive-cygwin AT delorie DOT com X-Spam-Check-By: sourceware.org Date: Fri, 14 Aug 2009 11:08:52 +0200 From: Corinna Vinschen To: cygwin AT cygwin DOT com Subject: Re: Cygwin1.dll 1.7.0-5x: RSYNC failures in close() system call on pipe file descriptors Message-ID: <20090814090852.GD32408@calimero.vinschen.de> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com References: <4A844A97 DOT 1050809 AT sipxx DOT com> <20090813183053 DOT GU13438 AT calimero DOT vinschen DOT de> <4A848D0A DOT 1000900 AT sipxx DOT com> <4A84C48E DOT 9070006 AT sipxx DOT com> <4A84C671 DOT 3050309 AT sipxx DOT com> <4A84EBB4 DOT 5050502 AT sipxx DOT com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4A84EBB4.5050502@sipxx.com> User-Agent: Mutt/1.5.19 (2009-02-20) Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com http://cygwin.com/acronyms/#TOFU On Aug 14 00:44, cygwin wrote: > Further tests with this little program show that the observed error only > occurs when the socket is dup()'ed to STDIN (fd = 0), but not when > dup'ed to any other fd number. To test, replace STDIN_FILENO in the dup > call with any positive integer (except 3 and 4). > Also, explicitly closing STDIN in advance of the dup call has no effect, > as it should since dup should close exisiting fd automatically. > This moves the problem area at least down into dtable::dup_worker and > build_fh_pc() > how is STDIN handled differently? > [...] >>> I wrote a small test program to isolate the problem from RSYNC. >>> The problem occurs when a file descriptor obtained from socketpair() >>> is dup2()'ed into STDIN and then closed. The close call fails. >>> Output from the program is as follows: >>> >>> socket 1 = 3 >>> socket 2 = 4 >>> dup2 socket 1... >>> closing socket 1... >>> close: Socket operation on non-socket >>> closing socket 1 failed >>> >>> >>> It is interesting to note that the close() is successful when the >>> dup2 calling sequence is omitted. >>> Since socketpair() in cygwin appears to use AF_INET sockets to >>> simulate AF_UNIX it might be interesting to try this on a single INET >>> socket. I tried your test application under Cygwin 1.7.0-58 on XP SP3, 2003 R2 x64 SP2, 2008 SP2, W7, W7 x64, to no avail. On all systems the test runs fine. Did you look for http://cygwin.com/acronyms/#BLODA and http://cygwin.com/1.7/faq/faq.using.html#faq.using.bloda? Corinna -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Project Co-Leader cygwin AT cygwin DOT com Red Hat -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple