From owner-freebsd-hackers@FreeBSD.ORG Sun Jul 21 06:34:23 2013 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id D49A7246 for ; Sun, 21 Jul 2013 06:34:23 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-we0-x231.google.com (mail-we0-x231.google.com [IPv6:2a00:1450:400c:c03::231]) by mx1.freebsd.org (Postfix) with ESMTP id 72AC762F for ; Sun, 21 Jul 2013 06:34:23 +0000 (UTC) Received: by mail-we0-f177.google.com with SMTP id m19so4966625wev.22 for ; Sat, 20 Jul 2013 23:34:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=DqNBcQMVkg2T/Dyhe8z7Pb3ySvukkwo/D3gNkPTgO7A=; b=KAhnPGywS2WAtRGsbLInmLlDaKIheaphr6qxuHnFhvvWL6whZ2iVeD0YKPkBMgeqSf BYty/sFMtLkLEEEbreTmXcHVCmwOSczQ2QE7UVKkJeIFyEdMRRdzlzly1zfcv+gHBF8j ayOK9e0tHQkS+awNiI2VtqdcrAx/hIMYAS4eusRrz1grFTDz+gnYmr/h5izokY60Nk0Z 8Wpl7XzgRu/BV1rB+K3BbjWKfIRiRzvas1Ft2Gww90yTaDXCejvhsPtdJmmi92cquCk4 S0pHZL9FWPOmxvmfyXpNjGnyyaVlLglIIF3/oZe/LegYpGnN0/Y+emXxbsxQU3QqpgE7 gGVA== MIME-Version: 1.0 X-Received: by 10.180.185.148 with SMTP id fc20mr15475379wic.0.1374388462589; Sat, 20 Jul 2013 23:34:22 -0700 (PDT) Sender: adrian.chadd@gmail.com Received: by 10.217.94.132 with HTTP; Sat, 20 Jul 2013 23:34:22 -0700 (PDT) In-Reply-To: <9921.1374330712@server1.tristatelogic.com> References: <9921.1374330712@server1.tristatelogic.com> Date: Sat, 20 Jul 2013 23:34:22 -0700 X-Google-Sender-Auth: _uKAyGxm-tn2kTet9O3ZQb0RBok Message-ID: Subject: Re: bin/176713: [patch] nc(1) closes network socket too soon From: Adrian Chadd To: "Ronald F. Guilmette" Content-Type: text/plain; charset=ISO-8859-1 Cc: freebsd-hackers@freebsd.org X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Jul 2013 06:34:23 -0000 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 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"