Make-initrd development discussion
 help / color / mirror / Atom feed
* [make-initrd] Release libshell 0.6.0
@ 2026-09-30 20:03 Alexey Gladkov
  0 siblings, 0 replies; only message in thread
From: Alexey Gladkov @ 2026-09-30 20:03 UTC (permalink / raw)
  To: make-initrd


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



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-09-30 20:03 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-30 20:03 [make-initrd] Release libshell 0.6.0 Alexey Gladkov

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