Re: Nested expansion in heredoc fails

2023-01-10 Thread Norbert Lange
On Wed, 14 Dec 2022, 16:09 Chet Ramey, wrote: > On 12/13/22 12:42 PM, Norbert Lange wrote: > > > Bash Version: 5.2 > > Patch Level: 2 > > Release Status: release > > > > Description: > > Parameter expansion within heredocs fails. > > > > The code below works with other shells aswell as bash 5.1 >

Re: UBSAN error in lib/sh/random.c:79

2023-01-10 Thread Chet Ramey
On 1/10/23 11:43 AM, Greg Wooledge wrote: On Sat, Jan 07, 2023 at 01:42:20PM -0500, Greg Wooledge wrote: Or should the code do the multiplications with unsigned values, store them in unsigned variables, and then replace the subtraction with some kind of conditional that checks which of the two i

Re: UBSAN error in lib/sh/random.c:79

2023-01-10 Thread Greg Wooledge
On Sat, Jan 07, 2023 at 01:42:20PM -0500, Greg Wooledge wrote: > Or should the code do the multiplications with unsigned > values, store them in unsigned variables, and then replace the subtraction > with some kind of conditional that checks which of the two is greater? Here's a version that does

Re: UBSAN error in lib/sh/random.c:79

2023-01-10 Thread Chet Ramey
On 1/7/23 1:45 PM, Martin Schulte wrote: Hello! Am Sat, 07 Jan 2023 19:08:06 +0100 schrieb Andreas Schwab : On Jan 07 2023, Greg Wooledge wrote: ... I think the original overflow can only happen if the argument of intrand32 is bigger than INT_MAX. Question might be if an overflow does any h

Re: UBSAN error in lib/sh/random.c:79

2023-01-10 Thread Chet Ramey
On 1/6/23 8:37 PM, Sam James wrote: Hi folks, I'm currently testing common Linux userland with UndefinedBehaviorSanitizer (UBSAN, -fsanitize=undefined). With Bash 5.2_p15, I get the following with this script: ``` $ cat /tmp/guess_suffix guess_suffix() { tmpdir="${TMPDIR}"/.ecompress$