From owner-freebsd-hackers@FreeBSD.ORG Mon Jul 22 02:50:49 2013 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 08DBF719 for ; Mon, 22 Jul 2013 02:50:49 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-wg0-x233.google.com (mail-wg0-x233.google.com [IPv6:2a00:1450:400c:c00::233]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 004481DA6 for ; Mon, 22 Jul 2013 02:50:47 +0000 (UTC) Received: by mail-wg0-f51.google.com with SMTP id e11so5384752wgh.18 for ; Sun, 21 Jul 2013 19:50:46 -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=afcA05fwEPMmKSm9rtCwRiDWgSbQRqnlU7SZiaq96cA=; b=Y0qkQF7jMm3u5hifvZ0KsEQCxo3oYrAZCTWJTDFVwYp5bZt5ed4JIFkoPP3BxUscpH kJzC3NLOxQ4TxPTLhbYqluiqh4zyV73ONcT1n/qsDgLTw+iyG09rYPc2VSRN+1iMFImY bq2ssEZfvRW4EMA/ylMbtmNsTofPzJ4W9lIR+xip1DC+f0ZoUyO8nJMXrCvQ0Jsa/rCk s+Z5sktEnqCv5BgA51HqA9lTitBOJmDPOusfyD7qdhJ3kVcJDVg7bGw1AqTZNRKHewlP s0fpAt8n+G2bKOrDsPYZ4QIgButc3uQTz64353w5fOH7VoJYRh9DRhZW59TMSokflmrS bUuA== MIME-Version: 1.0 X-Received: by 10.194.63.229 with SMTP id j5mr17614281wjs.79.1374461446377; Sun, 21 Jul 2013 19:50:46 -0700 (PDT) Sender: adrian.chadd@gmail.com Received: by 10.217.94.132 with HTTP; Sun, 21 Jul 2013 19:50:46 -0700 (PDT) In-Reply-To: <91998.1374458546@server1.tristatelogic.com> References: <91998.1374458546@server1.tristatelogic.com> Date: Sun, 21 Jul 2013 19:50:46 -0700 X-Google-Sender-Auth: RDiArvYtdbJ8ceMYNJum-uatgjA 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: Mon, 22 Jul 2013 02:50:49 -0000 On 21 July 2013 19:02, Ronald F. Guilmette wrote: > It has been some time now since I filed my PR but I think that the bottom > line is that you need to look at the code (of nc) to understand how it is > reacting to EOF on stdin. Gah, I was kinda hoping not to look at nc, and just work with someone else to figure out the right solution. I'm being slack :) > My recollection is that it exits as soon as it sees that (i.e. EOF on > its own stdin). My proposed patch corrects this unfortunate behavior. OK. Let me re-read this. I _think_ the correct behaviour is: * if it's done a shutdown(fd, WR) - then it shouldn't error out on EOF events on writes to the FD * But it shouldn't get a read EOF on the socket until the remote side signifies it. Is nc seeing EOF on reading form the server side prematurely? That's why I'm confused. -adrian