From: Alexey Gladkov <legion@kernel.org>
To: make-initrd@lists.altlinux.org
Subject: [make-initrd] Release libshell 0.6.0
Date: Wed, 30 Sep 2026 22:03:50 +0200
Message-ID: <ar1rJoX2EBG0IqFO@example.org> (raw)
New release 0.6.0 is available.
This is primarily a bug fix and performance improvement release. I
discovered a few quirks in various shell implementations, and taking these
into account can significantly improve performance.
# Changes
- shell-array:
+ Added a new module providing a dense, zero-based array library on top of
ordinary shell variables: shell_array_append, shell_array_set,
shell_array_get, shell_array_pop and shell_array_unset. An array named A
keeps its element count in the variable A and its elements in A0 through
AN-1; operations never leak stale contents of unset slots. No external
utilities are used and no forks occur per element.
/The implementation is the same as the one used in make-initrd/
- shell-git-config:
+ Fixed indented comment lines being parsed as variables. Git treats any
leading whitespace as ignorable, so an indented comment line in a git
config file was previously reported as a variable named
'# indented comment' with value 'true' and rewritten as a literal
'# indented comment = true' line by git_config_set, git_config_append
and git_config_list. Indented comments and indented sections are now
recognized just like git does and survive rewrites verbatim.
- shell-config:
+ Fixed shell_config_set failing to create a missing file when given a
bare relative name, e.g. shell_config_set conf k v. The writability
check used the file name itself instead of the current directory and
rejected the call with "conf: not writable."
- shell-bitwise:
+ Fixed toggle_bits failing on non-bash shells due to a stray bash-only
printf -v statement at the top of the function.
+ Fixed fill_mask, set_bits, clear_bits and toggle_bits overwriting the
caller's variable when the result was requested in a variable named m,
p, n, number or __res: temporary variables are now named after their
function to avoid such collisions.
- shell-json:
+ Fixed escaped backslashes being treated as escaping the following
character, so that a valid document like {"p":"abc\\"} failed with an
unfinished string error. Escapes are now tracked explicitly and
consumed once.
+ Fixed the parser accepting malformed documents such as [1,], {"a":},
[1 2] and 1., ignoring trailing garbage and accepting incomplete numbers
and invalid string escapes. The parser now requires one complete
top-level value, enforces container separators, validates number and
string syntax, and preserves newlines as token boundaries; CRLF is
accepted as whitespace outside of strings.
- shell-string:
+ Optimized character-by-character iteration over a string. The shell
type is now probed once instead of on every iteration, the dash/ash
walker no longer builds a full '?'-mask up front and gets each character
by trimming it off the line, and fill_mask is built by a bit-doubling
construction instead of a quadratic chunk-by-chunk copy.
- shell-ip-address:
+ Optimized ipv4_ptonx and ipv6_ptonx. Formatted output now uses builtin
hex-digit lookups and the echo builtin instead of forking an external
printf per octet (or per 16-bit group): 10 to 100 times faster on shells
without a builtin printf. Output format is unchanged.
- shell-var:
+ Optimized shell_var_trim. Leading and trailing whitespace is now
removed by parameter expansions instead of peeling one character at a
time in a loop: 4.7x faster on dash, 6.0x on bash and 7.9x on mksh.
- mans:
+ Rewrote all 22 shell-* reference pages against the current sources so
that they match the actual behaviour of the functions, and added
per-function examples that were checked against the running module.
# Git repository
https://github.com/legionus/libshell/releases/tag/v0.6.0
As always, feedback and bug reports are welcome.
--
Rgrds, legion
reply other threads:[~2026-09-30 20:03 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ar1rJoX2EBG0IqFO@example.org \
--to=legion@kernel.org \
--cc=make-initrd@lists.altlinux.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Make-initrd development discussion
This inbox may be cloned and mirrored by anyone:
git clone --mirror http://lore.altlinux.org/make-initrd/0 make-initrd/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 make-initrd make-initrd/ http://lore.altlinux.org/make-initrd \
make-initrd@lists.altlinux.org make-initrd@lists.altlinux.ru make-initrd@lists.altlinux.com
public-inbox-index make-initrd
Example config snippet for mirrors.
Newsgroup available over NNTP:
nntp://lore.altlinux.org/org.altlinux.lists.make-initrd
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git