Date: Sat, 20 Jul 2013 23:34:22 -0700 From: Adrian Chadd <adrian@freebsd.org> To: "Ronald F. Guilmette" <rfg@tristatelogic.com> Cc: freebsd-hackers@freebsd.org Subject: Re: bin/176713: [patch] nc(1) closes network socket too soon Message-ID: <CAJ-VmomyAi51VDzFh=QzbtT4EBsvsP4BocoE9-7Ca44Z1tcCGA@mail.gmail.com> In-Reply-To: <9921.1374330712@server1.tristatelogic.com> References: <9921.1374330712@server1.tristatelogic.com>
next in thread | previous in thread | raw e-mail | index | archive | help
Wait a second. What's going on under the hood? You _should_ be able to shutdown the write side of the socket and have it not affect reading. It's a broken server if it does a read(), find that the socket is returning EOF, and then not waiting for the write() to fail before closing. If that's actually what's going on - if you can verify that indeed its not some local broken handling of shutdown(fd, WR) then yes, I think it's worth changing nc. And I do think it's worth adding a "call shutdown(fd, WR) once the sender is finished" option for people that want it. -adrian On 20 July 2013 07:31, Ronald F. Guilmette <rfg@tristatelogic.com> wrote: > > > Could someone please take a look at this bug report (bin/176713) and > also at the simple patch that I provided to fix the problem? > > This is quite a serious problem, and my PR has been pending with no > action since Wed, 6 Mar 2013. > > > Regards, > rfg > > > P.S. Please note that in reality, I do not believe that it is necessary > to add a new -q option in order to preserve backwards compatability, however > I proposed one because in my experience there is always going to be some > purist who will claim that *any* change in semantics, however small or > helpful, in *any* software ``may'' break something. In reality, the > problem in this can most easily be solved simply by removing the one > statement: > > shutdown(nfd, SHUT_WR); > > entirely from the source, rather than making it conditional on -q, as I > suggested in my PR, bin/176713. > > P.P.S. I have just realized that yet one more critical enhancement for > nc is called for, and I will be filing a separate and additional PR for > that soon. I hope that someone will be able to take a look at that as > soon as it is filed. > _______________________________________________ > freebsd-hackers@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-hackers > To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org"
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAJ-VmomyAi51VDzFh=QzbtT4EBsvsP4BocoE9-7Ca44Z1tcCGA>