Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 7 Jan 2019 12:45:46 -0700
From:      Gavin Howard <gavin.d.howard@gmail.com>
To:        cem@freebsd.org
Cc:        Dimitry Andric <dim@freebsd.org>, "freebsd-arch@freebsd.org" <freebsd-arch@freebsd.org>
Subject:   Re: GNU-compatible, BSD-licensed bc
Message-ID:  <CAF=dzRNJMvNq0yiPPdWNk-F8--RPX3D6aydLpmLLX3xyvMAoQw@mail.gmail.com>
In-Reply-To: <CAG6CVpU-rgUVvWYDA%2B2qw62hzK1xOEqVwmXGSx2yrfqNMX8e7w@mail.gmail.com>
References:  <CAF=dzRNnurahLBOaKgq8_bDXNuM8biYPFbj6F2vp0t58Ejp8bg@mail.gmail.com> <A6C4B09B-4156-47A4-89B0-80E8688D59FC@FreeBSD.org> <CAG6CVpU-rgUVvWYDA%2B2qw62hzK1xOEqVwmXGSx2yrfqNMX8e7w@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
 On Mon, Jan 7, 2019 at 11:06 AM Dimitry Andric <dim@freebsd.org> wrote:
>
> On 7 Jan 2019, at 19:35, Gavin Howard <gavin.d.howard@gmail.com> 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 <cem@freebsd.org> 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

Gavin Howard



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAF=dzRNJMvNq0yiPPdWNk-F8--RPX3D6aydLpmLLX3xyvMAoQw>