From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on sa.local.altlinux.org X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,RP_MATCHES_RCVD autolearn=ham autolearn_force=no version=3.4.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1790798635; bh=Olw4XUM58lJBAFWlVLKVsUECS6JrFSeTKUezVsyIIfc=; h=Date:From:To:Subject; b=Xs/69rXMQ8ALFrjGcE+WhnpwGb+weJ5lMrHDBrx3PlWpg5XmFrKkPpv4w8j6+ij7j Gg/ZwR+ls1Iszts/rrJbqm1CQSQj0V8Im2on74pTraNN+QdG//PY9xNRFcbrnl8l6g eBc9IWF7jgF+CWDtdwvOjkMRlmEH0oTPuLPyuRllwSlX/hb4Hz9KzI+rwMltXFCs/5 qSNI8Bd986wQG4bee+tDgZb+EOdrn2zZvStRnwijHRCrS7/AvKFliM1m5ctdGv7h0X LnXIuXXb/VAFA+Itv4hqVycB+g1kN1yocAjd71j3mBtr5vZwloS21S9WE+pPJaXH9M wYn27UifluX8Q== Date: Wed, 30 Sep 2026 22:03:50 +0200 From: Alexey Gladkov To: make-initrd@lists.altlinux.org Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Subject: [make-initrd] Release libshell 0.6.0 X-BeenThere: make-initrd@lists.altlinux.org X-Mailman-Version: 2.1.12 Precedence: list Reply-To: make-initrd@lists.altlinux.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Sep 2026 20:11:02 -0000 Archived-At: List-Archive: 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