GNU-compatible, BSD-licensed bc

classic Classic list List threaded Threaded
28 messages Options
12
Reply | Threaded
Open this post in threaded view
|

GNU-compatible, BSD-licensed bc

Gavin Howard
Hello,

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?

Gavin Howard
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-arch
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: GNU-compatible, BSD-licensed bc

Dimitry Andric-4
On 7 Jan 2019, at 19:35, Gavin Howard <[hidden email]> 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?

-Dimitry


signature.asc (230 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: GNU-compatible, BSD-licensed bc

Conrad Meyer-2
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

On Mon, Jan 7, 2019 at 11:06 AM Dimitry Andric <[hidden email]> wrote:

>
> On 7 Jan 2019, at 19:35, Gavin Howard <[hidden email]> 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?
>
> -Dimitry
>
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-arch
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: GNU-compatible, BSD-licensed bc

Gavin Howard
 On Mon, Jan 7, 2019 at 11:06 AM Dimitry Andric <[hidden email]> wrote:

>
> On 7 Jan 2019, at 19:35, Gavin Howard <[hidden email]> 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 <[hidden email]> 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
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-arch
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: GNU-compatible, BSD-licensed bc

Conrad Meyer-2
On Mon, Jan 7, 2019 at 11:46 AM Gavin Howard <[hidden email]> wrote:

>
>  On Mon, Jan 7, 2019 at 11:06 AM Dimitry Andric <[hidden email]> wrote:
> > 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.
>
>...
>
> 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,

This all sounds great to me.  Consider me on-board with the idea.

Thanks,
Conrad
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-arch
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: GNU-compatible, BSD-licensed bc

Stefan Esser-3
In reply to this post by Gavin Howard
Am 07.01.19 um 20:45 schrieb Gavin Howard:

>  On Mon, Jan 7, 2019 at 11:06 AM Dimitry Andric <[hidden email]> wrote:
>>
>> On 7 Jan 2019, at 19:35, Gavin Howard <[hidden email]> 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 <[hidden email]> 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=     [hidden email]
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 <bsd.port.mk>

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
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-arch
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: GNU-compatible, BSD-licensed bc

A. Wilcox
In reply to this post by Conrad Meyer-2
On 01/07/19 15:10, Conrad Meyer wrote:

> On Mon, Jan 7, 2019 at 11:46 AM Gavin Howard <[hidden email]> wrote:
>> The non-important ones include the fact that I support *every* GNU
>> extension. That includes array references, void functions, the "halt"
>> keyword, etc.
>>
>> 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,
>
> This all sounds great to me.  Consider me on-board with the idea.
>
> Thanks,
> Conrad

If it means anything, we're using it as our sole bc(1) implementation in
Adélie Linux.  No issues or complaints from here; it works flawlessly.

Best,
--arw

--
A. Wilcox (awilfox)
Open-source programmer (C, C++, more)
https://ko-fi.com/K3K8MQZJ


signature.asc (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: GNU-compatible, BSD-licensed bc

Devin Teske-3
In reply to this post by Gavin Howard


> On Jan 7, 2019, at 10:35 AM, Gavin Howard <[hidden email]> wrote:
>
> Hello,
>
> 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?
>

I quickly glanced at the Makefile.in and configure.sh and didn't see any mention
of crypto/ssl, hoping you had support for OpenSSL BIGNUM(3).

How do you handle arbitrary arithmetic precision?
--
Devin

_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-arch
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: GNU-compatible, BSD-licensed bc

Conrad Meyer-2
In reply to this post by Stefan Esser-3
Hi Stefan,

I don't think there's any reason to put this in ports instead of base.
If you're arguing that we shouldn't ship any bc in base, that's a fine
argument to make, but it's off-topic for this discussion.

If at some point after that you want to remove bc from base and fix
all of the fallout of that much larger change, you are welcome to take
on that (much larger) project.

Best,
Conrad

On Mon, Jan 7, 2019 at 2:06 PM Stefan Esser <[hidden email]> wrote:

>
> Am 07.01.19 um 20:45 schrieb Gavin Howard:
> >  On Mon, Jan 7, 2019 at 11:06 AM Dimitry Andric <[hidden email]> wrote:
> >>
> >> On 7 Jan 2019, at 19:35, Gavin Howard <[hidden email]> 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 <[hidden email]> 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=     [hidden email]
> 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 <bsd.port.mk>
>
> 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
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-arch
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: GNU-compatible, BSD-licensed bc

Conrad Meyer-2
In reply to this post by Devin Teske-3
On Mon, Jan 7, 2019 at 4:00 PM Devin Teske <[hidden email]> wrote:
> How do you handle arbitrary arithmetic precision?

Looks like https://github.com/gavinhoward/bc/blob/master/src/num.c .
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-arch
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: GNU-compatible, BSD-licensed bc

Gavin Howard
On Mon, Jan 7, 2019 at 5:38 PM Conrad Meyer <[hidden email]> wrote:
>
> On Mon, Jan 7, 2019 at 4:00 PM Devin Teske <[hidden email]> wrote:
> > How do you handle arbitrary arithmetic precision?
>
> Looks like https://github.com/gavinhoward/bc/blob/master/src/num.c .

That is correct. Because this bc is meant to help bootstrap the Linux
kernel and have no dependencies other than POSIX 2008, I wrote my own.
Also, the POSIX bc standard mandates doing math in decimal. OpenSSL
would not be smart if they did that. There are also a few
peculiarities with the POSIX bc standard that (more or less) require a
standalone implementation.

Also, right now I am working on getting a release candidate out that
will enable me to make a quick port that Stefan could use as a jumping
off point. My build system changed between 1.0 and now, and I would
like to be able to test it.

Gavin Howard
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-arch
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: GNU-compatible, BSD-licensed bc

Gavin Howard
In reply to this post by Conrad Meyer-2
On Mon, Jan 7, 2019 at 5:59 PM Conrad Meyer <[hidden email]> wrote:

>
> Hi Stefan,
>
> I don't think there's any reason to put this in ports instead of base.
> If you're arguing that we shouldn't ship any bc in base, that's a fine
> argument to make, but it's off-topic for this discussion.
>
> If at some point after that you want to remove bc from base and fix
> all of the fallout of that much larger change, you are welcome to take
> on that (much larger) project.
>
> Best,
> Conrad

I would be plenty happy to just get my bc into ports, but I would be
*ecstatic* to have it in base. Personally, I think it should be in
base because POSIX requires it, and this bc would be more useful to a
wide array of users.

That said, I am not a FreeBSD contributor (yet), so my opinion should
not really matter.

> On Mon, Jan 7, 2019 at 2:06 PM Stefan Esser <[hidden email]> wrote:
> >
> > Am 07.01.19 um 20:45 schrieb Gavin Howard:
> > >  On Mon, Jan 7, 2019 at 11:06 AM Dimitry Andric <[hidden email]> wrote:
> > >>
> > >> On 7 Jan 2019, at 19:35, Gavin Howard <[hidden email]> 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 <[hidden email]> 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=     [hidden email]
> > 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 <bsd.port.mk>
> >
> > It could probably made to not require GNU make, but I did not bother to
> > try this for this quickly written port Makefile.

I have a Makefile that works without GNU make:

```
# $FreeBSD$

PORTNAME=        gh-bc
PORTVERSION=     1.1rc3
CATEGORIES=      math

MAINTAINER=      [hidden email]
COMMENT=         GNU compatible bc/dc calculator

LICENSE=         BSD
LICENSE_FILE=    ${WRKSRC}/LICENSE.md

USE_GITHUB=      yes
GH_ACCOUNT=      gavinhoward
GH_PROJECT=      bc

HAS_CONFIGURE=   yes
CONFIGURE_ARGS=  -O3

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 <bsd.port.mk>
```

There is only one thing I could not get to work: running `make
package` as a user. It always gave me permissions issues, and I am a
FreeBSD noob, so I did not know how to fix it.

For the `pkg-descr` file, I mostly copied the one from gnubc:

```
bc is an arbitrary precision numeric processing language.  Its syntax is similar
to C but differs in many substantial areas.  It supports interactive execution
of statements. The bc utility is included in the POSIX 1003.1-2008 standard.

WWW: https://github.com/gavinhoward/bc
```

> > 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.

Ah, yes, sorry. There *is* one (https://spdx.org/licenses/0BSD.html),
but SPDX only added it in December, IIRC.

> > 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 make the above Makefile work, I put out a release candidate. When I
do an actual release (within two or three weeks), we can update it to
the *actual* version 1.1. But the Makefile above uses my current build
system, so changing it for the new version should be as simple as
removing "rc3" from the version.

Also, the build sequence changed for git clones:

$ ./configure -O3
$ make

(I decided to make the port easier to do by renaming `configure.sh` to
the more standard `configure`.)

> > To distinguish this port from other bc implementations I'd suggest to
> > name it "math/gh-bc" ...

Whatever works. That was the name I put into the Makefile itself.

Gavin Howard
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-arch
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: GNU-compatible, BSD-licensed bc

Devin Teske-3
In reply to this post by Gavin Howard


> On Jan 7, 2019, at 4:42 PM, Gavin Howard <[hidden email]> wrote:
>
> On Mon, Jan 7, 2019 at 5:38 PM Conrad Meyer <[hidden email]> wrote:
>>
>> On Mon, Jan 7, 2019 at 4:00 PM Devin Teske <[hidden email]> wrote:
>>> How do you handle arbitrary arithmetic precision?
>>
>> Looks like https://github.com/gavinhoward/bc/blob/master/src/num.c .
>
> That is correct. Because this bc is meant to help bootstrap the Linux
> kernel and have no dependencies other than POSIX 2008, I wrote my own.

Impressive. It might be worth turning this into a library itself.


> Also, the POSIX bc standard mandates doing math in decimal. OpenSSL
> would not be smart if they did that.

Not sure I understand what you mean here.


> There are also a few
> peculiarities with the POSIX bc standard that (more or less) require a
> standalone implementation.
>

How hard would it be to convert a bn(3)-based library to use your code?
Would there be any performance impact -- I've benchmarked bn(3) to
be pretty fast.


> Also, right now I am working on getting a release candidate out that
> will enable me to make a quick port that Stefan could use as a jumping
> off point. My build system changed between 1.0 and now, and I would
> like to be able to test it.
>

Cool. Looking forward to it.
--
Cheers,
Devin
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-arch
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: GNU-compatible, BSD-licensed bc

Gavin Howard
On Mon, Jan 7, 2019 at 10:57 PM Devin Teske <[hidden email]> wrote:

>
>
>
> > On Jan 7, 2019, at 4:42 PM, Gavin Howard <[hidden email]> wrote:
> >
> > On Mon, Jan 7, 2019 at 5:38 PM Conrad Meyer <[hidden email]> wrote:
> >>
> >> On Mon, Jan 7, 2019 at 4:00 PM Devin Teske <[hidden email]> wrote:
> >>> How do you handle arbitrary arithmetic precision?
> >>
> >> Looks like https://github.com/gavinhoward/bc/blob/master/src/num.c .
> >
> > That is correct. Because this bc is meant to help bootstrap the Linux
> > kernel and have no dependencies other than POSIX 2008, I wrote my own.
>
> Impressive. It might be worth turning this into a library itself.

Eh...it is completely tuned for bc. And it won't be fast,
unfortunately. See below.

> > Also, the POSIX bc standard mandates doing math in decimal. OpenSSL
> > would not be smart if they did that.
>
> Not sure I understand what you mean here.

Well, for starters, OpenSSL's BIGNUM is integer only. Yes, those
integers can be any size, but they are only integers. That is not good
enough for bc; it has to allow arbitrary precision, including
non-integers, and its fractional part can be any size, up to a certain
limit, which you can get from my bc by typing "limits" at the prompt
and looking for the value of BC_NUM_MAX (which is actually the maximum
number of decimal digits, period).

Also, while bc requires arithmetic to be in decimal, OpenSSL probably
uses unsigned integers to do binary-based arithmetic. Let me explain.
(And yes, I am explaining in detail, even though you probably know
this already. I am just making sure I cover my bases.)

In any (normal) bignum implementation, a bignum is going to be an
array of hardware-based integers (in the case of OpenSSL, probably
unsigned ints). A normal bignum implementation would use the entire
range (or almost the entire range) of that integer type. For 32-bit
unsigned integers, that means that each "limb" (item in the bignum
array) can hold 2^32 integers. For a hardware-based, unsigned integer
implementation, that means that it only needs one item in the array
until the bignum is bigger than 2^32-1. Once it overflows that,
another unsigned integer will be added to the array and gets the
overflow. This allows the bignum implementation at least 2 advantages:
1) it can use very fast hardware types, and 2) the size of the bignum
array is kept as small as possible.

I could not do that for bc. Each "limb" could only hold one decimal
digit, meaning that each item in the array was limited to 10^1
numbers. Obviously, that is *much* smaller than 2^32. Now, in my bc, I
use unsigned chars, so my limbs are 1/4 the size of the limbs in a
32-bit-based bignum, but each limb can only use a small fraction of
the range of an unsigned char. This means three things: 1) I have to
manually check for overflow over 9, which adds code, 2) math on each
limb in the bc takes longer than in a 32-bit-based bignum, since
unsigned chars have to be zero-extended to the size of an unsigned int
before doing the actual math, and 3) the amount of memory needed (on
average) is much higher (though it would be astronomical if I used
unsigned ints). I also have to store the location of the radix
(decimal point) and sometimes perform more expensive operations when
doing math on digits behind the radix.

I would not have written it that way, but the POSIX bc spec mandated
it. (See https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html#tag_20_09_13_03,
where it says "Internal computations shall be conducted as if in
decimal, regardless of the input and output bases, to the specified
number of decimal digits.") So, in essence, a bc-based bignum library
is never going to be very fast. And it generally doesn't have to be;
it interacts directly with a user most of the time, and users are slow
compared to computers. Now, I have taken a few pains to make sure my
bc is as fast as possible, under the circumstances, but the math is
still the most expensive part.

It's kind of freaky, actually. My parser zips through my math library
fast enough that the user doesn't even notice the load lag, and though
my bytecode interpreter is not slow, it is not fast either, since my
parser does not optimize the bytecode. Despite that, the math is
consistently taking about 80+ percent of the time, and that percentage
goes *way* up when there are bigger numbers, since only addition and
subtraction are linear. (I do use Karatsuba for multiplication, and it
is a miracle, but it is still superlinear.)

> > There are also a few
> > peculiarities with the POSIX bc standard that (more or less) require a
> > standalone implementation.
> >
>
> How hard would it be to convert a bn(3)-based library to use your code?
> Would there be any performance impact -- I've benchmarked bn(3) to
> be pretty fast.

It would not be terribly hard, but as I said above, it would not be
fast at all, at least compared to a well-written hardware-based,
binary bignum implementation. But if you want to, go ahead; I would
appreciate the credit (though the license does not even require that).

> > Also, right now I am working on getting a release candidate out that
> > will enable me to make a quick port that Stefan could use as a jumping
> > off point. My build system changed between 1.0 and now, and I would
> > like to be able to test it.
> >
>
> Cool. Looking forward to it.

It's out. It works great. The Makefile that I sent to the mailing list
a few messages back does the job well enough, though I was told in a
private message not to use the GNU bc port's pkg-descr file, since it
might be under the GPL.

However, note that this is not the final 1.1 release; it is just for
testing, even though it is high quality.

Gavin Howard
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-arch
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: GNU-compatible, BSD-licensed bc

Baptiste Daroussin-2
In reply to this post by Conrad Meyer-2
On Mon, Jan 07, 2019 at 01:10:34PM -0800, Conrad Meyer wrote:

> On Mon, Jan 7, 2019 at 11:46 AM Gavin Howard <[hidden email]> wrote:
> >
> >  On Mon, Jan 7, 2019 at 11:06 AM Dimitry Andric <[hidden email]> wrote:
> > > 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.
> >
> >...
> >
> > 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,
>
> This all sounds great to me.  Consider me on-board with the idea.
>
Nice, Count me on board as well :)

Best regards,
Bapt

signature.asc (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: GNU-compatible, BSD-licensed bc

Stefan Esser-3
In reply to this post by Conrad Meyer-2
Am 08.01.19 um 01:31 schrieb Conrad Meyer:> Hi Stefan,
>
> I don't think there's any reason to put this in ports instead of base.
> If you're arguing that we shouldn't ship any bc in base, that's a fine
> argument to make, but it's off-topic for this discussion.

Hi Conrad,

yes, sure, if it passes our tests (I understand that it passes
its own test suite) it should definitely be considered for base.
I did not want to suggest a removal of bc from base at this time.

But given our release cycle it will take a long time for this bc
to actually occur in a release - that's why I proposed to create
a port that could be depended on by other ports that currently
require GNU bc.

This would also provide us with more confidence, that this version
is actually a fully compatible replacement for GNU bc.

> If at some point after that you want to remove bc from base and fix
> all of the fallout of that much larger change, you are welcome to take
> on that (much larger) project.

No, that's not what I wanted to suggest at this time. An existing
port will reduce the effort required to test removal of bc from
base (if only slightly), but bc is quite useful in base (unlike
e.g. ctm or timed), and I'd expect it to stay ...

Regards, STefan
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-arch
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: GNU-compatible, BSD-licensed bc

Conrad Meyer-2
Hi Stefan,

Apologies, I misunderstood the idea.

However, it seems like any port that depends on gnubc today could continue
to depend on gnubc on older branches until a suitable replacement
propagates into stable.  (And that would be less work :-).)

Best,
Conrad

On Tue, Jan 8, 2019 at 2:28 AM Stefan Esser <[hidden email]> wrote:

> Am 08.01.19 um 01:31 schrieb Conrad Meyer:> Hi Stefan,
> >
> > I don't think there's any reason to put this in ports instead of base.
> > If you're arguing that we shouldn't ship any bc in base, that's a fine
> > argument to make, but it's off-topic for this discussion.
>
> Hi Conrad,
>
> yes, sure, if it passes our tests (I understand that it passes
> its own test suite) it should definitely be considered for base.
> I did not want to suggest a removal of bc from base at this time.
>
> But given our release cycle it will take a long time for this bc
> to actually occur in a release - that's why I proposed to create
> a port that could be depended on by other ports that currently
> require GNU bc.
>
> This would also provide us with more confidence, that this version
> is actually a fully compatible replacement for GNU bc.
>
> > If at some point after that you want to remove bc from base and fix
> > all of the fallout of that much larger change, you are welcome to take
> > on that (much larger) project.
>
> No, that's not what I wanted to suggest at this time. An existing
> port will reduce the effort required to test removal of bc from
> base (if only slightly), but bc is quite useful in base (unlike
> e.g. ctm or timed), and I'd expect it to stay ...
>
> Regards, STefan
>
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-arch
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: GNU-compatible, BSD-licensed bc

Stefan Esser-3
Am 08.01.19 um 22:35 schrieb Conrad Meyer:
> Hi Stefan,
>
> Apologies, I misunderstood the idea.
>
> However, it seems like any port that depends on gnubc today could continue
> to depend on gnubc on older branches until a suitable replacement
> propagates into stable.  (And that would be less work :-).)

Yes, but the work has already been done ;-)

I've been exchanging private mails with Gavin and he has worked
on his "bc", e.g. to make the included tests run on FreeBSD out
of the box (they used to require GNU bc).

A few small issues have been fixed and he is looking into another
one (^D handling). Working on the port (and tests performed with
its preliminary version) has already improved the quality of the
code that is about to be imported into base ...

If users actually try running with Gavin's bc (as a port) before
it makes it into a release, there is a good chance that any
unexpected incompatibilitiy (e.g., if it is compatible with GNU
bc, but behaves differently from our current bc in base) is found
in time.

So, I intend to proceed with an import as a port, independently
of the import into base, which I appreciate, too.

Regards, STefan
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-arch
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: GNU-compatible, BSD-licensed bc

Warner Losh
On Wed, Jan 9, 2019 at 5:33 AM Stefan Esser <[hidden email]> wrote:

> Am 08.01.19 um 22:35 schrieb Conrad Meyer:
> > Hi Stefan,
> >
> > Apologies, I misunderstood the idea.
> >
> > However, it seems like any port that depends on gnubc today could
> continue
> > to depend on gnubc on older branches until a suitable replacement
> > propagates into stable.  (And that would be less work :-).)
>
> Yes, but the work has already been done ;-)
>
> I've been exchanging private mails with Gavin and he has worked
> on his "bc", e.g. to make the included tests run on FreeBSD out
> of the box (they used to require GNU bc).
>
> A few small issues have been fixed and he is looking into another
> one (^D handling). Working on the port (and tests performed with
> its preliminary version) has already improved the quality of the
> code that is about to be imported into base ...
>
> If users actually try running with Gavin's bc (as a port) before
> it makes it into a release, there is a good chance that any
> unexpected incompatibilitiy (e.g., if it is compatible with GNU
> bc, but behaves differently from our current bc in base) is found
> in time.
>
> So, I intend to proceed with an import as a port, independently
> of the import into base, which I appreciate, too.
>

We've had several BSDL'd things that started life as a port. I think this
is a great strategy: make it available TODAY as a port (since the barrier
to entry is small), if it pans out, integrate into base.

Warner
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-arch
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: GNU-compatible, BSD-licensed bc

Gavin Howard
On Wed, Jan 9, 2019 at 8:29 AM Warner Losh <[hidden email]> wrote:

>
> On Wed, Jan 9, 2019 at 5:33 AM Stefan Esser <[hidden email]> wrote:
>
> > Am 08.01.19 um 22:35 schrieb Conrad Meyer:
> > > Hi Stefan,
> > >
> > > Apologies, I misunderstood the idea.
> > >
> > > However, it seems like any port that depends on gnubc today could
> > continue
> > > to depend on gnubc on older branches until a suitable replacement
> > > propagates into stable.  (And that would be less work :-).)
> >
> > Yes, but the work has already been done ;-)
> >
> > I've been exchanging private mails with Gavin and he has worked
> > on his "bc", e.g. to make the included tests run on FreeBSD out
> > of the box (they used to require GNU bc).
> >
> > A few small issues have been fixed and he is looking into another
> > one (^D handling). Working on the port (and tests performed with
> > its preliminary version) has already improved the quality of the
> > code that is about to be imported into base ...

Yes, it has, and the fix for ^D handling is now in master.

> > If users actually try running with Gavin's bc (as a port) before
> > it makes it into a release, there is a good chance that any
> > unexpected incompatibilitiy (e.g., if it is compatible with GNU
> > bc, but behaves differently from our current bc in base) is found
> > in time.

I already know that there are differences, but it seems to be more
from bugs in your current bc. For example, when running the
`tests/bc/scripts/parse.bc` script, which generates a test of *just*
numbers (and assignments to ibase), the current bc generates a colon
(`:`) for some reason. I have no idea why, and it seems to me that it
is probably a bug, since a colon is not a valid digit. I could be
wrong, though; I haven't dug into it.

> > So, I intend to proceed with an import as a port, independently
> > of the import into base, which I appreciate, too.
> >
>
> We've had several BSDL'd things that started life as a port. I think this
> is a great strategy: make it available TODAY as a port (since the barrier
> to entry is small), if it pans out, integrate into base.

Sounds good to me too. I was going to wait until I had full manuals
written before releasing, but if it will just be a port at first, I
will release quickly (by the end of the week, hopefully) and work on
manuals later. Then I can release again right before the next code
freeze, or whatever would be desired.

Gavin Howard
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-arch
To unsubscribe, send any mail to "[hidden email]"
12