From owner-svn-src-all@freebsd.org Sat Feb 22 03:14:06 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1BABF24DAEC; Sat, 22 Feb 2020 03:14:06 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48PYMK6WG2z4LGW; Sat, 22 Feb 2020 03:14:05 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D37861D0A9; Sat, 22 Feb 2020 03:14:05 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 01M3E5Zq096136; Sat, 22 Feb 2020 03:14:05 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 01M3E5xJ096135; Sat, 22 Feb 2020 03:14:05 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202002220314.01M3E5xJ096135@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sat, 22 Feb 2020 03:14:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r358235 - head/bin/sh X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/bin/sh X-SVN-Commit-Revision: 358235 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Feb 2020 03:14:06 -0000 Author: kevans Date: Sat Feb 22 03:14:05 2020 New Revision: 358235 URL: https://svnweb.freebsd.org/changeset/base/358235 Log: sh: fix read builtin on 32-bit systems Specifically, any system with a 32-bit size_t; -residue is calculated as a 32-bit *then* promoted to the 64-bit off_t and the result is ultimately wrong. This resulted in what would appear to be truncated output, as only the first line would be read. Correct it by just making residue an off_t to begin with, since this is what lseek will take anyways. Reported by: antoine, dim Triaged by: cem Tested by: kevans X-MFC-With: r358152 Modified: head/bin/sh/miscbltin.c Modified: head/bin/sh/miscbltin.c ============================================================================== --- head/bin/sh/miscbltin.c Sat Feb 22 01:31:06 2020 (r358234) +++ head/bin/sh/miscbltin.c Sat Feb 22 03:14:05 2020 (r358235) @@ -117,7 +117,7 @@ fdgetc(struct fdctx *fdc, char *c) static void fdctx_destroy(struct fdctx *fdc) { - size_t residue; + off_t residue; if (fdc->buflen > 1) { /*