Repository navigation
bash-logger 3.0.0: dash and busybox ash support, and about ten times faster logging #149
GingerGraham
announced in
Announcements
Replies: 1 comment
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
bash-logger 3.0.0 is out.
logging.shnow runs in dash and busybox ash as well as bash and zsh, so/bin/shscripts on Debian, Ubuntu and Alpine can use it. It is also much faster.This is a major version because some edge-case behaviour changed. No public function,
init_loggeroption, configuration key or documented variable was removed. Most bash scripts need no changes.What's new
--posix, zsh, dash and busybox ash. Use. /path/to/logging.shin a POSIX sh script.dateprocess for each timestamp. bash 3.2, dash and busybox still usedate. The cost of a large message now grows in proportion to its size.CONFIGnotices follow the stderr level: thanks to @s-fairchild, messages fromset_*functions such asLog format changedno longer corrupt stdout in a script that sets--stderr-leveltoNOTICE,INFOorDEBUG. With the default stderr level, they stay on stdout.init_logger --formatwith no value used to hang bash. It now returns an error.-n,-eor-Ewere logged as empty. They are now logged as written.08or09made bash exit a script running withset -e. It no longer does.infoandcriticalnow work in a Turkish locale.set_*function is now reported, and no longer exits a script running withset -e.unknown.set -uworks.Security
3.0.0 fixes a log injection issue in zsh, described in GHSA-pqwh-fgqr-gmm9. In every release up to 2.7.0, a literal
\n,\033or\cin a logged message was turned into a real newline, escape character or truncation after sanitizing, so a message could write a forged log line. bash is affected only with thexpg_echooption on.If you use bash-logger with zsh, please upgrade.
What could affect you
Check these if you are upgrading from 2.x:
--stderr-level NOTICE,INFOorDEBUGand readCONFIGnotices from stdout. They now go to stderr.[unknown]as the script name.CURRENT_LOG_LEVELdirectly with something other than a number. For example,CURRENT_LOG_LEVEL=LOG_LEVEL_ERRORno longer works. UseCURRENT_LOG_LEVEL=$LOG_LEVEL_ERRORorset_log_level ERROR.dateto fix the time in log lines. That no longer has an effect in bash 4.2+ and zsh.One known limitation: zsh 5.9 has a bug that can crash a script when signal handlers run during
[commands, and 3.0 uses[where 2.x used[[. It is unlikely unless a script receives frequent signals and logs from the handlers.The full list is in Upgrading to 3.0.
How it was tested
--posix, zsh, dash and busybox.3.0 is the first release to run on Alpine, so I would especially like to hear how it goes there.
Upgrading, or staying on 2.7.0
The install script and bpkg's
@maininstall 3.0.0 from now on, and workbench modules trackingmainor the latest release pick it up at their next sync.To stay on 2.7.0 while you test:
Only 3.x receives fixes from now on.
The install script and bpkg need bash. On a system without it, such as a default Alpine image, download
logging.shdirectly:Feedback
Please reply here with how the upgrade went, especially if you use dash, busybox or zsh. Please open an issue for a bug, and report security problems privately as described in SECURITY.md.
As described in CONTRIBUTING.md, I use GitHub Copilot and Claude to help develop, review and test this project. That includes this release.
All reactions