[PATCH] bc Version 1.1

Gavin Howard gavin.d.howard at gmail.com
Sat Nov 3 17:17:09 UTC 2018


Hello,

After making changes to the bc for Denys' requests, I have a better
version of the bc.

This version, pasted at https://pastebin.com/0M9sMhtM and raw at
https://pastebin.com/raw/0M9sMhtM, has fulfilled every one of Denys'
requests except for a few.

First, I still did not use read_line_input. The reason for this is
because bc_read_line does some important error checking. I did,
however, #if guard signal handling and add a config for it. And I made
my signal handling function less buggy (in a single-threaded
environment).

I used getopt32 (and getopt32long behind a config option). I changed
CONFIG_foo to ENABLE_foo. I made everything but bc_main and dc_main
static. I called xmalloc_open_read_close in bc_read_file, but still
kept error handling.

I also tried to pull nested assignments out where I could, but there
were a few places where doing so introduced bugs. That said, all of
them are out (as far as I can tell), unless they could not be, so I
would not mess with them any further if I were you.

On that note, if you do mess with them, you want the full test suite
while reviewing this code, which you can get by cloning my repo at
https://github.com/gavinhoward/bc and then run the following commands:

$ $BC_ROOT/tests/all.sh bc $BUSYBOX_ROOT/busybox bc
$ $BC_ROOT/tests/all.sh dc $BUSYBOX_ROOT/busybox dc

If you also want to test the Linux kernel timeconst script, you can run:

$ $BC_ROOT/tests/bc/timeconst.sh ./path/to/timeconst.bc
$BUSYBOX_ROOT/busybox bc

I changed my code to call xmalloc and friends, which is actually what
allowed me to pull out assignments. The code ended up *much* smaller
than what I have already given to Landley for toybox, so I tried
pulling them out, and when I did, the code was *still* smaller. We'll
hope that is good enough for him. Also, because of clang-format, I was
able to change the braces in my release script, thus making it work
for both toybox and busybox.

With that said, after testing this thing as hard as I can, I am
supremely confident in it, and I believe that, barring any small bugs,
it is feature-complete and basically finished. Because of that, I am
willing to hand it completely over to busybox, if the maintainers so
desire, although I am willing to support it directly, as well as share
responsibility. I am good with whatever.

Thank you for your patience to this point.

Gavin Howard


More information about the busybox mailing list