This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: rsync + xp sp2 failing


On Sep 9,  9:36am, joellists@iwcenter.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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]