Re: [PATCH] asort: some bug fixes

2023-03-25 Thread Emanuele Torre
On Sun, Mar 26, 2023 at 08:19:25AM +0200, Emanuele Torre wrote: > -sa = xmalloc(n * sizeof(sort_element)); > +if (n) > + sa = xmalloc (n * sizeof(sort_element)); > i = 0; > for ( j = 0; j < hash->nbuckets; ++j ) { > bucket = hash->bucket_array

[PATCH] asort: some bug fixes

2023-03-25 Thread Emanuele Torre
- add some missing free() - avoid calling xmalloc(0) - fix f () { local b; asort -i b a ;} not updating b if b is declared but doesn't have a value using builtin_find_indexed_array() instead of find_or_make_array_variable(): bash-5.2$ typeset a=(z y x) b c=1; asort -i b a; asort -i c a

Re: parsing command substitution inside parameter expansion in interactive shell

2023-03-25 Thread Grisha Levit
On Mon, Mar 20, 2023 at 4:59 PM Chet Ramey wrote: > Thanks, it's an easy fix to preserve the newline here. FWIW even with the latest fixes, this kind of nesting in a history entry still triggers ASAN: bash --norc -in <<<$'${_+$(\n \cP\en ' ERROR: AddressSanitizer: heap-buffer-overflow READ of s

Re: [PATCH] Port lib/sh/tmpfile.c to hosts without mkdtemp

2023-03-25 Thread Chet Ramey
On 3/24/23 5:20 PM, Paul Eggert wrote: * lib/sh/tmpfile.c (sh_mktmpdir) [!USE_MKDTEMP]: Fix use of undeclared var 'fd'. Thanks for the report. Chet -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, UTech, CWRU

Re: $SECONDS and timeout values use realtime `gettimeofday()`

2023-03-25 Thread Martin D Kealey
On Fri, 24 Mar 2023 at 10:42, William Kennington via Bug reports for the GNU Bourne Again SHell wrote: > It would be nice if $SECONDS was using `clock_gettime(CLOCK_MONOTONIC, > &val)` as it would usually make the most sense when you want to know the > time since the script started. Generally n