## 3.3.0
This is a production release that changes one behavior and fixes documentation
bugs.
The changed behavior is the treatment of `-e` and `-f` when given through
`BC_ENV_ARGS` or `DC_ENV_ARGS`. Now `bc` and `dc` do not exit when those options
(or their equivalents) are given through those environment variables. However,
`bc` and `dc` still exit when they or their equivalents are given on the
command-line.
Note that "DC_ENV_ARGS" will lead to dc exiting; this was new in 3.1.4
and I have reported that upstream.
Upstream changes, less bugfixes (and hence first/second do not make
sense; see the full NEWS.md in the sources if that upsets you):
## 3.2.5
This is a production release that fixes several bugs and adds a couple small
things.
The two most important bugs were bugs that causes `dc` to access memory
out-of-bounds (crash in debug builds). This was found by upgrading to `afl++`
from `afl`. Both were caused by a failure to distinguish between the same two
cases.
Fourth, the pseudo-random number now attempts to seed itself with `/dev/random`
if `/dev/urandom` fails.
## 3.2.0
This is a production release that has one bug fix and a major addition.
The major addition is a way to build a version of `bc`'s math code as a library.
This is done with the `-a` option to `configure.sh`. The API for the library can
be read in `./manuals/bcl.3.md` or `man bcl` once the library is installed with
`make install`.
This library was requested by developers before I even finished version 1.0, but
I could not figure out how to do it until now.
If the library has API breaking changes, the major version of `bc` will be
incremented.
## 3.1.4
This is a production release that fixes one bug, changes two behaviors, and
removes one environment variable.
The behavior that was changed is that `bc` now exits when given `-e`, `-f`,
`--expression` or `--file`. However, if the last one of those is `-f-` (using
`stdin` as the file), `bc` does not exit. If `-f-` exists and is not the last of
the `-e` and `-f` options (and equivalents), `bc` gives a fatal error and exits.
Next, I removed the `BC_EXPR_EXIT` and `DC_EXPR_EXIT` environment variables
since their use is not needed with the behavior change.
Finally, I made it so `bc` does not print the header, though the `-q` and
`--quiet` options were kept for compatibility with GNU `bc`.
At my request, upstream added a flag to install all locales, rather
than the locales that are installed on the current system. This leads
to a consistent PLIST (and more locales).
## 3.1.2
This is a production release that adds a way to install *all* locales. Users do
***NOT*** need to upgrade.
For package maintainers wishing to make use of the change, just pass `-l` to
`configure.sh`.
Notable upstream changes:
## 3.1.0
The behavior that was adjusted was how code from the `-e` and `-f` arguments
(and equivalents) were executed. They used to be executed as one big chunk, but
in this release, they are now executed line-by-line.
The first bug fix in how output to `stdout` was handled in `SIGINT`. If a
`SIGINT` came in, the `stdout` buffer was not correctly flushed. In fact, a
clean-up function was not getting called. This release fixes that bug.
The second bug is in how `dc` handled input from `stdin`. This affected `bc` as
well since it was a mishandling of the `stdin` buffer.
The third fixed bug was that `bc` and `dc` could `abort()` (in debug mode) when
receiving a `SIGTERM`. This one was a race condition with pushing and popping
items onto and out of vectors.
The fourth bug fixed was that `bc` could leave extra items on the stack and
thus, not properly clean up some memory. (The memory would still get
`free()`'ed, but it would not be `free()`'ed when it could have been.)
The next two bugs were bugs in `bc`'s parser that caused crashes when executing
the resulting code.
The last two bugs were crashes in `dc` that resulted from mishandling of
strings.
## 3.0.2
This is a production release that adds `utf8` locale symlinks and removes an
unused `auto` variable from the `ceil()` function in the [extended math
library][16].
## 3.0.1
The second change is to make the new implementation of `ceil()` in `lib2.bc`
much more efficient.
Upstream changes:
multiple bug fixes and minor improvements
redesign of signal handling (not intended to be user visible)
Besides the following, see NEWS in the sources for details.
*First, the `2.7.0` release series saw a change in the option parsing. This made
me change one error message and add a few others. The error message that was
changed removed one format specifier. This means that `printf()` will seqfault
on old locale files. Unfortunately, `bc` cannot use any locale files except the
global ones that are already installed, so it will use the previous ones while
running tests during install. **If `bc` segfaults while running arg tests when
updating, it is because the global locale files have not been replaced. Make
sure to either prevent the test suite from running on update or remove the old
locale files before updating.** Once this is done, `bc` should install without
problems.*
*Second, **the option to build without signal support has been removed**. See
below for the reasons why.*
This is a production release with some small bug fixes, a few improvements,
three major bug fixes, and a complete redesign of `bc`'s error and signal
handling. **Users and package maintainers should update to this version as soon
as possible.**
Upstream NEWS highlights:
(translations and bugfixes omitted)
## 2.7.2
This is a production release with one major bug fix.
The `length()` built-in function can take either a number or an array. If it
takes an array, it returns the length of the array. Arrays can be passed by
reference. The bug is that the `length()` function would not properly
dereference arrays that were references. This is a bug that affects all users.
**ALL USERS SHOULD UPDATE `bc`**.
## 2.7.0
There is only one new feature: **`bc` now has a built-in pseudo-random number
generator** (PRNG).
The PRNG is seeded, making it useful for applications where
`/dev/urandom` does not work because output needs to be reproducible. However,
it also uses `/dev/urandom` to seed itself by default, so it will start with a
good seed by default.
On top of that, four functions were added to `bc`'s [extended math library][16]
to make using the PRNG easier:
* `frand(p)`: Generates a number between `[0,1)` to `p` decimal places.
* `ifrand(i, p)`: Generates an integer with bound `i` and adds it to `frand(p)`.
* `srand(x)`: Randomizes the sign of `x`. In other words, it flips the sign of
`x` with probability `0.5`.
* `brand()`: Returns a random boolean value (either `0` or `1`).
## 2.4.0
* The `bc` `&&` and `||` operators were made available to `dc` through the `M`
and `m` commands, respectively.
* `dc` macros were changed to be tail call-optimized.
The last item, tail call optimization, means that if the last thing in a macro
is a call to another macro, then the old macro is popped before executing the
new macro. This change was made to stop `dc` from consuming more and more memory
as macros are executed in a loop.
The `q` and `Q` commands still respect the "hidden" macros by way of recording
how many macros were removed by tail call optimization.
Upstream changes:
This release is a production release.
The following bugs were fixed:
A dc bug that caused stack mishandling was fixed.
A warning on OpenBSD was fixed.
Bugs in ctrl+arrow operations in history were fixed.
The ability to paste multiple lines in history was added.
A bc bug, mishandling of array arguments to functions, was fixed.
A crash caused by freeing the wrong pointer was fixed.
A dc bug where strings, in a rare case, were mishandled in parsing was fixed.
In addition, the following changes were made:
Division was slightly optimized.
An option was added to the build to disable printing of prompts.
The special case of empty arguments is now handled. This is to
prevent errors in scripts that end up passing empty arguments.
A harmless bug was fixed. This bug was that, with the pop
instructions (mostly) removed (see below), bc would leave extra
values on its stack for void functions and in a few other
cases. These extra items would not affect anything put on the
stack and would not cause any sort of crash or even buggy
behavior, but they would cause bc to take more memory than it
needed.
On top of the above changes, the following optimizations were added:
The need for pop instructions in bc was removed.
Extra tests on every iteration of the interpreter loop were removed.
Updating function and code pointers on every iteration of the
interpreter loop was changed to only updating them when necessary.
Extra assignments to pointers were removed.
Altogether, these changes sped up the interpreter by around 2x.
NOTE: This is the last release with new features because this bc is
now considered complete. From now on, only bug fixes and new
translations will be added to this bc.
Implementation of POSIX bc with GNU extensions
This bc is optimized for use by programmers. It includes several
extensions beyond the GNU extensions for that purpose.
Prepared in pkgsrc-wip by Gavin Howard.