From owner-freebsd-current@freebsd.org Sat Jul 4 09:50:44 2020 Return-Path: Delivered-To: freebsd-current@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 B265C367562 for ; Sat, 4 Jul 2020 09:50:44 +0000 (UTC) (envelope-from o.hartmann@walstatt.org) Received: from mout.gmx.net (mout.gmx.net [212.227.17.20]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "mout.gmx.net", Issuer "TeleSec ServerPass Class 2 CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49zRsb4Gq0z4RRF; Sat, 4 Jul 2020 09:50:43 +0000 (UTC) (envelope-from o.hartmann@walstatt.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1593856240; bh=T+tSGgIyDAG6zfNnXYwHuQyxAkI/0FFZK/43AmtUlXk=; h=X-UI-Sender-Class:Date:From:To:Cc:Subject:In-Reply-To:References; b=knMOO7m5LZXVAK8pPFxK5lmGIbCj+es2F1MGTZ9VwPhQjcxNEBykKi1EGWCWW+Qlu 4n80Xv8u51/jJx0RE8B3P7aR6T2NxRrWEP3pCh1fq/KOs7rWcEMf8WTZW2ZLbd84sE SL59EM5uUKkZnX6Jb+CpGZdI+byK39GciyUc4E3A= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from hermann.fritz.box ([77.191.123.155]) by mail.gmx.com (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1M8ykg-1jxhDy1VVW-0069ax; Sat, 04 Jul 2020 11:50:40 +0200 Date: Sat, 4 Jul 2020 11:50:31 +0200 From: "Hartmann, O." To: Stefan =?ISO-8859-1?Q?E=DFer?= Cc: FreeBSD CURRENT Subject: Re: CURRENT: bc -e results in empty string/result Message-ID: <20200704115031.5f9ee55c@hermann.fritz.box> In-Reply-To: <82c80079-2e33-dfea-4553-37806c6fbe60@freebsd.org> References: <20200703172503.5b739102@thor.intern.walstatt.dynvpn.de> <82c80079-2e33-dfea-4553-37806c6fbe60@freebsd.org> Organization: walstatt.org MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; boundary="Sig_/av3=YoL9+Cp2o74+XQe3Sjx"; protocol="application/pgp-signature" X-Provags-ID: V03:K1:XSiZZCSvKaQAO+ulSzVrpYY96zcwiBrZZafg91HaoxvUGmSebdL t/nOTC/IaD9xoNLBzEtN498bTmKBTfQ7nDfGmjgNJwpYxBaNwyg+opyNmDzjQ9isiMwhiFf CFCRqfB/1q3jJoLRPfT0SDkN/WW8HnqZRY0itrHyKOfbCoUB5++pVI4KcHm9QiULfQu0Ozh mzps6xhg1Wumtz4kCPl6w== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:AEoInhEl6l4=:A09DuYTZauoYqf6Q5n9l54 xkeZqK9mEZZYo9vE0kBHBm4DhR2+R4L+X71G7pN/7QSiKz6VCDiWDG1n8gjXoZkhKRc/uRhwk 38q6flzAdweunB8nBLDqT6JerjpooknC+CV5Rf7Bvf0KIrpdaJWFeGat76fj0cAa7eIZs+w8M RHiSemA2fMA5JlXjmfBAZ/k+iLuICjiOA1pzPY5gVlg/U4e3zDoSS75kG/DyQmvYNcoQ8VFOP zKfmABEJqnAGHicVq/xM/ioKvELS9PhQnGUnl0rcfApMJ7p+NX76ZIJr6R22eyTRayy9xaWrF Mjtpope3EV8tQB9VZVY4Bk/mLAF2tiDXHYz64H+RpPs3GSSFruqfFEvLze2kQCW5KcNIiNIvA RbAKEWtsgJfn09NwbYHNU20llFleCducon0KUB04xlxCoYdxiJXVzIbeLc3rXUcu4KKocPsP5 ge6IT8IMMij8KxJLgB7vGc/M2naRotCjHMnQezFmufQgzQCwNgpi7eEqhTcfwG/KViyhL6pUu ovGGeSKZ45HjxEiGYMpltlV/DrB6V984PEsUrXNdiRy567qrYGmFfnaVgebZ0qDWyhEQfgMs8 1Qg8FbckoM7YrPTT0GEhxhhW4C10x/b2t92auYFLCkhuURBQig8ilPifCfBWLltlSaX1E36d8 P64GRPTquTPu67+0zNuWdmf+gUxmxl2gg/2h2jw1K2iynSFKckOW59slN+Q+dBJ+9LWqtGIJ5 W0JiX+l+++JgJHiZoRHNe79cG2WVMqJcQlN/LX/o1t3iTUpHYIX3RV4zpuD3bwsqHHstfOLbD QGmSHXCA8zmsltkBcfTnT9mD+PJIbmFuhOHfwn7stfNLD9Nh6AW0qAXyHUV0O1MP0H2yagYxD R310QpicRLoLUeRVB81Qf8+pyrGFj3t5ZXRfkSN7HoW0ACkdnfOFl0GMBClnBPOwbm30lWgaL +L5Z7XQjBoOwJ5RoFJZogrc1QgPYMYFe5ZHg5Y8kFzYr4n3NWJ6P2jNDKCi+SFHuAHzEXbjj4 AsgF2cFarL41qwblybcn24QikQ8kej6olYZdu6o6iel69ttQz2p1EyCjFFGCd7lRzP+cRzkBP avgz8qmndhX6kxxTI+f/OpqKz78QXjpRnbQdxlb3ZqPC3C4kLTrGqlpAmmghNufT9XO7a5tYE qJY9hbJeXGtLNyqG4cLr8KpOaCeWa7YZWFrLDNNRXaE5Ugo1ihTSVfuk0n1KP9S9PphLvhKDb R8beK2g5vdoaSHp7t X-Rspamd-Queue-Id: 49zRsb4Gq0z4RRF X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmx.net header.s=badeba3b8450 header.b=knMOO7m5; dmarc=none; spf=none (mx1.freebsd.org: domain of o.hartmann@walstatt.org has no SPF policy when checking 212.227.17.20) smtp.mailfrom=o.hartmann@walstatt.org X-Spamd-Result: default: False [-1.82 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[gmx.net:s=badeba3b8450]; RWL_MAILSPIKE_POSSIBLE(0.00)[212.227.17.20:from]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-0.37)[-0.372]; MIME_GOOD(-0.20)[multipart/signed,text/plain]; DMARC_NA(0.00)[walstatt.org]; NEURAL_HAM_MEDIUM(-0.83)[-0.825]; HAS_ORG_HEADER(0.00)[]; RECEIVED_SPAMHAUS_PBL(0.00)[77.191.123.155:received]; TO_DN_ALL(0.00)[]; DKIM_TRACE(0.00)[gmx.net:+]; RCPT_COUNT_TWO(0.00)[2]; NEURAL_HAM_SHORT(-0.13)[-0.128]; R_SPF_NA(0.00)[no SPF record]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; ASN(0.00)[asn:8560, ipnet:212.227.0.0/16, country:DE]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; RCVD_IN_DNSWL_LOW(-0.10)[212.227.17.20:from] X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Jul 2020 09:50:44 -0000 --Sig_/av3=YoL9+Cp2o74+XQe3Sjx Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Fri, 3 Jul 2020 17:58:27 +0200 Stefan E=C3=9Fer wrote: > Am 03.07.20 um 17:24 schrieb O. Hartmann: > > Hello list, > >=20 > > running some scripts caluclating via bc() the expression shown > > below: > >=20 > > bc -e '6582031 - 1048576 - 0 - 409600 - 1024 - 40 - 4096' -e quit =20 >=20 > The bc in -CURRENT has been replaced by a new implementation. >=20 > It seems there is one deviation from the behavior of the "old" > version, in that it executes the "quit" immediately after parsing it. >=20 > There is a difference between "quit" and "halt", and the following > command works as expected: >=20 > $ bc -e '6582031 - 1048576 - 0 - 409600 - 1024 - 40 - 4096' -e halt > 5118695 >=20 > From the bc man-page: >=20 > The quit statement causes bc(1) to quit, even if it is on a branch > that will not be executed (it is a compile-time command). >=20 > The halt statement causes bc(1) to quit, if it is executed. (Unlike > quit if it is on a branch of an if statement that is not executed, > bc(1) does not quit.) >=20 > This behavior is identical to that of GNU bc: >=20 > $ echo "6582031 - 1048576 - 0 - 409600 - 1024 - 40 - 4096; quit " | > gbc $ echo "6582031 - 1048576 - 0 - 409600 - 1024 - 40 - 4096; halt " > | gbc 5118695 >=20 > > results on recent CURRENT ( FreeBSD 13.0-CURRENT #80 r362884: Thu > > Jul 2 10:08:23 CEST 2020 amd64) with an empty result, while it is > > calculated correctly on 12-STABLE (FreeBSD 12.1-STABLE #67 r362719: > > Sun Jun 28 09:59:20 CEST 2020 amd64) and a CURRENT dated from Sun > > Jun 28th (have no revision number anymore, the expression above was > > calculated correctly on the same box which now has r362884 and is > > failing). > >=20 > > Whats wrong? =20 >=20 > The behavior of the "old" bc in FreeBSD was non-conformant in several > details, the result of a modulo operation with negative operands was > the most critical, in my opinion. >=20 > This is what POSIX says with regard to the "quit" command: >=20 > The quit statement ( quit) shall stop execution of a bc program at > the point where the statement occurs in the input, even if it occurs > in a function definition, or in an if, for, or while statement. >=20 > But I'm not sure whether this covers the behavior of GNU bc and this > new bc, since it does not say, that "quit" will be executed as soon > as seen by the parser. >=20 > Regards, STefan Hello. Unfortunately, there was no remark in UPDATING and in the hurry I did not find any traces of the change, so it hit me since several scripts failed. As a workaround, it helped to replace "-e quit" by "-e halt", although this might semantically also an unfortunate way to do. Thanks very much for the fast response, regards Oliver --Sig_/av3=YoL9+Cp2o74+XQe3Sjx Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iHUEARYIAB0WIQSy8IBxAPDkqVBaTJ44N1ZZPba5RwUCXwBQ6AAKCRA4N1ZZPba5 R1F/AQDL7Abkp+QOwsWM1DMnKhKWjyXFIGkgEahNyb3wW3gh9AEAvciCbkTRIQP6 DbKczphSp50pqt3NaXgS2DjLbqdL/gE= =d0Vi -----END PGP SIGNATURE----- --Sig_/av3=YoL9+Cp2o74+XQe3Sjx--