From owner-freebsd-hackers@freebsd.org Sun May 22 23:02:07 2016 Return-Path: Delivered-To: freebsd-hackers@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4FDD7B3B3A1 for ; Sun, 22 May 2016 23:02:07 +0000 (UTC) (envelope-from mmacy@nextbsd.org) Received: from sender163-mail.zoho.com (sender163-mail.zoho.com [74.201.84.163]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4381D1BAA for ; Sun, 22 May 2016 23:02:07 +0000 (UTC) (envelope-from mmacy@nextbsd.org) Received: from mail.zoho.com by mx.zohomail.com with SMTP id 1463958122647529.1151203261937; Sun, 22 May 2016 16:02:02 -0700 (PDT) Date: Sun, 22 May 2016 16:02:02 -0700 From: Matthew Macy To: "Joerg Sonnenberger" Cc: "" Message-ID: <154dab43060.11208cdfd132112.2616144627831899155@nextbsd.org> In-Reply-To: <20160522225414.GB24398@britannica.bec.de> References: <20160522225414.GB24398@britannica.bec.de> Subject: Re: read(2) and thus bsdiff is limited to 2^31 bytes MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Priority: Medium User-Agent: Zoho Mail X-Mailer: Zoho Mail X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 May 2016 23:02:07 -0000 ---- On Sun, 22 May 2016 15:54:14 -0700 Joerg Sonnenberger wrote ---- > On Sun, May 22, 2016 at 10:54:30PM +0200, Dirk Engling wrote: > > When trying to bsdiff two DVD images, I noticed it failing due to > > read(2) returning EINVAL to the tool. man 2 read says, this would only > > happen for a negative value for fildes, which clearly was not true. > > I would classify that as implementation bug. It seems perfectly sensible > to turn overly large requests into a short read/write, even for blocking > files. But erroring out seems to be quite wrong to me. > read(2) takes a size_t so this is clearly an internal bug where it's an int and treating it as a negative value. -M