From owner-freebsd-arch@freebsd.org Mon Jan 7 22:06:18 2019 Return-Path: Delivered-To: freebsd-arch@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 2FD9814A1395 for ; Mon, 7 Jan 2019 22:06:18 +0000 (UTC) (envelope-from se@freebsd.org) Received: from mailout08.t-online.de (mailout08.t-online.de [194.25.134.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mailout00.t-online.de", Issuer "TeleSec ServerPass DE-2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 79B5783909; Mon, 7 Jan 2019 22:06:17 +0000 (UTC) (envelope-from se@freebsd.org) Received: from fwd09.aul.t-online.de (fwd09.aul.t-online.de [172.20.27.151]) by mailout08.t-online.de (Postfix) with SMTP id F367C41B69B3; Mon, 7 Jan 2019 23:06:07 +0100 (CET) Received: from Stefans-MBP-WLAN.fritz.box (TQJ3-TZCrh3KxeFTYgbJ+mxcJdGmJXLA2icNKoLd49AZ5jdArHqlImXb62NrqT4Q1u@[93.200.55.94]) by fwd09.t-online.de with (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384 encrypted) esmtp id 1ggd27-1S3n720; Mon, 7 Jan 2019 23:06:07 +0100 Subject: Re: GNU-compatible, BSD-licensed bc To: Gavin Howard , cem@freebsd.org Cc: Dimitry Andric , "freebsd-arch@freebsd.org" References: From: Stefan Esser Openpgp: preference=signencrypt Autocrypt: addr=se@freebsd.org; prefer-encrypt=mutual; keydata= mQENBFVxiRIBCADOLNOZBsqlplHUQ3tG782FNtVT33rQli9EjNt2fhFERHIo4NxHlWBpHLnU b0s4L/eItx7au0i7Gegv01A9LUMwOnAc9EFAm4EW3Wmoa6MYrcP7xDClohg/Y69f7SNpEs3x YATBy+L6NzWZbJjZXD4vqPgZSDuMcLU7BEdJf0f+6h1BJPnGuwHpsSdnnMrZeI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fVEBQJa8u+rBQkL JQEZAAoJEEfrte9a/fVEuesH/2DNxGWnHvWwMyiyhlQtafvDKwEn/wAgR8gHJFodB7emf8rA TnukH7MVttCoHtjN5lvv9RSBHjNTZls5wR/ANlwdRuPQHd8ZGxLe3S6IuUB3zDSwFltLGurO N2kOMhs5mTGyypSa+uw3rtQbUAVYf1oPbiR4FLtiM8FLyEvE95hX5fPq9Qvx9FmN79kmCIEw jDKPqDaUf/OR2fEF0LSIbXHEk4tNqCEwx5DIJ0fp5/z5UzICUAmwxyRs5O/Hre1jzPsMVyud Ml9t7UTOJGKVWwRory1PMnOFxN+iz5/d4FhYSKXF7kfMiFgol4LuWaxJRwbBrr71VGBrRy2a L1nw6Bc= Message-ID: <1e025f53-fc5e-5b1e-013d-ab9330a0e9db@freebsd.org> Date: Mon, 7 Jan 2019 23:06:06 +0100 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252 Content-Language: en-US Content-Transfer-Encoding: 7bit X-ID: TQJ3-TZCrh3KxeFTYgbJ+mxcJdGmJXLA2icNKoLd49AZ5jdArHqlImXb62NrqT4Q1u X-TOI-MSGID: 72f13d6a-e61b-4f11-9fa2-cf6c7692ff2b X-Rspamd-Queue-Id: 79B5783909 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[freebsd.org]; NEURAL_HAM_MEDIUM(-0.99)[-0.994,0]; NEURAL_HAM_LONG(-1.00)[-0.996,0]; TAGGED_RCPT(0.00)[]; NEURAL_HAM_SHORT(-0.96)[-0.965,0]; ASN(0.00)[asn:3320, ipnet:194.25.0.0/16, country:DE] X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Jan 2019 22:06:18 -0000 Am 07.01.19 um 20:45 schrieb Gavin Howard: > On Mon, Jan 7, 2019 at 11:06 AM Dimitry Andric wrote: >> >> On 7 Jan 2019, at 19:35, Gavin Howard wrote: >>> >>> I am the author of a GNU-compatible, BSD-licensed bc >>> (https://github.com/gavinhoward/bc). I noticed (on >>> https://wiki.freebsd.org/GPLinBase) that FreeBSD used to use the GNU >>> bc until it was taken out because of the GPL. My bc is not licensed >>> under the GPL; it is under the 0BSD license. Thus, I think my bc might >>> be a great fit for FreeBSD. >>> >>> My bc is well-tested. I make sure that every single memory bug that I >>> can find is out before every single release. I also make sure that my >>> bc's math is correct by running millions of random math problems >>> before every release. >>> >>> My bc is extremely portable; it easily builds on any POSIX >>> platform. And it includes a full dc as well (except for the "!" >>> command). >>> >>> I would love to work with the core team to get my bc into FreeBSD, if >>> there is interest. I am about to do a release, and I am willing to >>> delay the release to get it up to par for FreeBSD. >>> >>> Would there be interest? >> >> You are 9 years late. :-) >> >> https://github.com/freebsd/freebsd/commit/bc4e1f6f87a770761be30eb708cbef88bc4d9536 >> >> That said, are you aware of any great differences between your bc and >> the one originally from OpenBSD? > > Yes. See below for the important one. > > The non-important ones include the fact that I support *every* GNU > extension. That includes array references, void functions, the "halt" > keyword, etc. > > On Mon, Jan 7, 2019 at 12:24 PM Conrad Meyer wrote: >> >> Thanks Gavin, >> >> I think this could be valuable for us. Our bc is not GNU-compatible >> today and that causes some pain. >> >> For example, fusefs-lkl requires the gnubc port to build because the >> base bc lacks some functionality that GNU has, and of course lkl uses >> the gnu bc functionality. So a BSDL bc that is actually >> GNU-compatible seems attractive to me. >> >> The script in question can be found here: >> https://github.com/torvalds/linux/blob/master/kernel/time/timeconst.bc >> and it is invoked like: "echo 100 | bc -q path/to/timeconst.bc". >> >> It can be reduced to the following short test case with the same invocation: >> >> a = read(); >> print "a: ", a, "\n" >> >> In-tree BSD bc prints "dc: not a string" on stderr and with the >> simplified test case, "a: 0\n100\n" on stdout. >> >> GNU bc prints "a: 100\n" on stdout, as expected. (I have not tried Gavin's bc.) >> >> Best, >> Conrad > > My bc handles the Linux timeconst.bc script with aplomb from 0 to (at > least) 1000. It is part of my test suite, actually. > > You can try it out by running the following command after building my > bc (where BC_ROOT is the root directory of my bc): > > $ "$BC_ROOT/tests/bc/timeconst.sh" /location/of/timeconst.bc > > It won't have any output besides "Running timeconst.bc..." unless it > didn't pass the test. > > Also, this bc builds out of the box on FreeBSD. I have already made > sure of that. Just use: > > $ cd "$BC_ROOT" > $ ./configure.sh -O3 > $ make To be able to provide binary packages we'd need this "bc" in ports. Creating a port should be very simple and I'd be willing to work on getting a port committed tomorrow. Ports that currently depend on GNU bc from ports could be converted to use this version instead. Even if it was imported into base today, there'd be supported releases without that bc version for quite some time to come. A simple port Makefile that works for me is: # $FreeBSD$ PORTNAME= gh-bc PORTVERSION= 1.0 CATEGORIES= math MAINTAINER= se@FreeBSD.org COMMENT= GNU compatible bc/dc calculator LICENSE= BSD LICENSE_FILE= ${WRKSRC}/LICENSE.md USES= gmake USE_GITHUB= yes GH_ACCOUNT= gavinhoward GH_PROJECT= bc PLIST_FILES= bin/bc bin/dc do-install: ${INSTALL_PROGRAM} ${WRKSRC}/bin/bc ${STAGEDIR}${PREFIX}/bin/ ${LN} ${STAGEDIR}${PREFIX}/bin/bc ${STAGEDIR}${PREFIX}/bin/dc .include It could probably made to not require GNU make, but I did not bother to try this for this quickly written port Makefile. There are 2 open points: 1) There is no 0BSD license - I have set the license name to BSD and the LICENSE.md file is included in the package, but I do not think that this is completely right. 2) I have used the release tag 1.0, which does not include the latest changes committed to Github. If the port should actually be based on a later code base, a new release tag would be beneficial. To distinguish this port from other bc implementations I'd suggest to name it "math/gh-bc" ... Regards, STefan