Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm 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 From: "Bob Byrnes" Date: Thu, 9 Sep 2004 16:25:53 -0400 In-Reply-To: <41405C49.6090502@iwcenter.com> from Joel (Sep 9, 9:36am) Organization: Curl Corporation X-Address: 1 Cambridge Center, 10th Floor, Cambridge, MA 02142-1612 X-Phone: 617-761-1238 X-Fax: 617-761-1201 To: cygwin AT cygwin DOT com Subject: Re: rsync + xp sp2 failing Message-Id: <20040909202553.8B672E598@wildcard.curl.com> On Sep 9, 9:36am, joellists AT iwcenter DOT com (Joel) wrote: -- Subject: rsync + xp sp2 failing > > Failed to dup/close : Socket operation on non-socket > rsync error: error in IPC code (code 14)@ > /home/lapo/package/tmp/rsync-2.6.2/pipe.c(73) > -- End of excerpt from Joel The rsync code in pipe.c looks like ... if (dup2(to_child_pipe[0], STDIN_FILENO) < 0 || close(to_child_pipe[1]) < 0 || close(from_child_pipe[0]) < 0 || dup2(from_child_pipe[1], STDOUT_FILENO) < 0) { rprintf(FERROR, "Failed to dup/close : %s\n", strerror(errno)); exit_cleanup(RERR_IPC); } ... so we need to determine why dup2 or close is failing. The "pipes" are created earlier by fd_pair ... int to_child_pipe[2]; int from_child_pipe[2]; ... if (fd_pair(to_child_pipe) < 0 || fd_pair(from_child_pipe) < 0) { rprintf(FERROR, "pipe: %s\n", strerror(errno)); exit_cleanup(RERR_IPC); } ... but they are in fact not pipes at all; they're actually socketpairs, for platforms like Cygwin that support socketpairs: /** * Create a file descriptor pair - like pipe() but use socketpair if * possible (because of blocking issues on pipes). * * Always set non-blocking. */ int fd_pair(int fd[2]) { int ret; #if HAVE_SOCKETPAIR ret = socketpair(AF_UNIX, SOCK_STREAM, 0, fd); #else ret = pipe(fd); #endif if (ret == 0) { set_nonblocking(fd[0]); set_nonblocking(fd[1]); } return ret; } Cygwin always uses inet sockets to implement socketpairs, even for AF_UNIX. That partially explains "Socket operation on non-socket". Has anything changed recently in the socketpair code? This seems unrelated to my recent implementation of selectable pipes. If you can reproduce this using strace, the last hundred lines or so of the strace output might be enlightening. -- Bob -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/