From owner-svn-src-head@freebsd.org Fri Feb 16 14:31:57 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 449D7F18C7B; Fri, 16 Feb 2018 14:31:57 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail105.syd.optusnet.com.au (mail105.syd.optusnet.com.au [211.29.132.249]) by mx1.freebsd.org (Postfix) with ESMTP id B85447C719; Fri, 16 Feb 2018 14:31:56 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from [192.168.0.102] (c110-21-101-228.carlnfd1.nsw.optusnet.com.au [110.21.101.228]) by mail105.syd.optusnet.com.au (Postfix) with ESMTPS id 0BA4E104B234; Sat, 17 Feb 2018 01:31:46 +1100 (AEDT) Date: Sat, 17 Feb 2018 01:31:45 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Benno Rice cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r329269 - head/stand/i386/boot2 In-Reply-To: <201802141807.w1EI7Ror036078@repo.freebsd.org> Message-ID: <20180217000503.F3685@besplex.bde.org> References: <201802141807.w1EI7Ror036078@repo.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=FNpr/6gs c=1 sm=1 tr=0 a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=kj9zAlcOel0A:10 a=zMeS5lR-rpC9UbJK_LUA:9 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Feb 2018 14:31:57 -0000 On Wed, 14 Feb 2018, Benno Rice wrote: > Log: > Reformat to come significantly closer to style(9). This gives unreadable diffs. It does more than reformatting. Bugs have been reported. They must be in the non-reformatting changes. > Modified: head/stand/i386/boot2/boot2.c > ============================================================================== > --- head/stand/i386/boot2/boot2.c Wed Feb 14 18:05:37 2018 (r329268) > +++ head/stand/i386/boot2/boot2.c Wed Feb 14 18:07:27 2018 (r329269) > ... > #if SERIAL > - } else if (c == 'S') { > - j = 0; > - while ((unsigned int)(i = *arg++ - '0') <= 9) > - j = j * 10 + i; > - if (j > 0 && i == -'0') { > - comspeed = j; > - break; > - } > - /* Fall through to error below ('S' not in optstr[]). */ > + } else if (c == 'S') { > + j = 0; > + while (*arg <= '9') { > + i = (unsigned int)(*arg - '0'); > + j = j * 10 + i; > + arg++; > + } > + if (j > 0 && i == -'0') { > + comspeed = j; > + break; > + } > + /* > + * Fall through to error below > + * ('S' not in optstr[]). > + */ > #endif The bugs seem to be only here. The old code uses a bogus cast to obfuscate its classification of digits. The change breaks the classification of digits by moving the cast to a place where it has no effect. Even space separators and '\0' terminators are now misclassified as digits. Space separators seem to be broken anyway, so -S only worked if it is the last arg. Now it never works, since the terminating char is never '\0'. Moving the increment of 'arg' is risky but seems to have no effect since -S must be at the end to work so no further advance of arg is useful. Bruce