Bug#973620: bash: overflow on integer variables greater than 9223372036854775807

2024-04-15 Thread Gioele Barabucci
Control: found -1 5.2.21-2 Control: tags -1 upstream X-Debbugs-CC: bug-bash@gnu.org On Mon, 2 Nov 2020 16:46:14 +0100 Antonio wrote: Dear Maintainer, recently while I was running some tests, I ran into this strange overflow: $ declare -i n=9223372036854775800; for((i=0; i<15; ++i)); do echo "$

Re: syntax error with lone > or < as string in [ ] tests with -a or -o operators

2024-04-15 Thread Chet Ramey
On 4/14/24 5:16 AM, Emanuel Attila Czirai wrote: Bash Version: 5.2 Patch Level: 26 Release Status: release Description: the [ test with -n or -z on a string that's only the angle bracket char followed by -a or -o operators, fails like: bash: [: syntax error: `-n' unexpected Repeat-By: $

Re: Examples of concurrent coproc usage?

2024-04-15 Thread Carl Edquist via Bug reports for the GNU Bourne Again SHell
On Sat, 13 Apr 2024, Chet Ramey wrote: The original intent was to allow the shell to drive a long-running process that ran more-or-less in parallel with it. Look at examples/scripts/bcalc for an example of that kind of use. Thanks for mentioning this example. As you understand, this model us

Re: syntax error with lone > or < as string in [ ] tests with -a or -o operators

2024-04-15 Thread Emanuel Attila Czirai
On Mon, Apr 15, 2024, 15:08 Chet Ramey wrote: > On 4/14/24 5:16 AM, Emanuel Attila Czirai wrote: > > > Bash Version: 5.2 > > Patch Level: 26 > > Release Status: release > > > > Description: > > the [ test with -n or -z on a string that's only the angle bracket > char > > followed by -a or -o

Re: syntax error with lone > or < as string in [ ] tests with -a or -o operators

2024-04-15 Thread Greg Wooledge
On Mon, Apr 15, 2024 at 07:04:23PM +0200, Emanuel Attila Czirai wrote: > In my superficial report, I definitely didn't think of that. I even forgot > to mention that it works when escaped like "\>" > > I've encountered it in the "adduser" FreeBSD sh script that runs as root, > while trying to set

Re: syntax error with lone > or < as string in [ ] tests with -a or -o operators

2024-04-15 Thread Emanuel Attila Czirai
On Mon, Apr 15, 2024 at 7:56 PM Greg Wooledge wrote: > On Mon, Apr 15, 2024 at 07:04:23PM +0200, Emanuel Attila Czirai wrote: > > In my superficial report, I definitely didn't think of that. I even > forgot > > to mention that it works when escaped like "\>" > > > > I've encountered it in the "ad

Re: syntax error with lone > or < as string in [ ] tests with -a or -o operators

2024-04-15 Thread Greg Wooledge
On Mon, Apr 15, 2024 at 08:13:23PM +0200, Emanuel Attila Czirai wrote: > On Mon, Apr 15, 2024 at 7:56 PM Greg Wooledge wrote: > > Sounds like you've found a nontrivial bug in FreeBSD (in the adduser > > script, not in sh). I hope this gets reported and fixed, and in any case, > > good work and th

Re: Examples of concurrent coproc usage?

2024-04-15 Thread Chet Ramey
On 4/14/24 2:43 PM, Zachary Santer wrote: On Sat, Apr 13, 2024 at 4:10 PM Chet Ramey wrote: The original intent was to allow the shell to drive a long-running process that ran more-or-less in parallel with it. Look at examples/scripts/bcalc for an example of that kind of use. $ ./bcalc equat

Re: syntax error with lone > or < as string in [ ] tests with -a or -o operators

2024-04-15 Thread Andreas Schwab
On Apr 15 2024, Greg Wooledge wrote: > And that's a bug. That code is wrong, and it should be written this way > instead: > > [ -z "$var1" ] && [ -z "$var2" ] && continue Or just [ -z "$var1$var2" ] && continue -- Andreas Schwab, sch...@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4

Re: Examples of concurrent coproc usage?

2024-04-15 Thread Zachary Santer
On Mon, Apr 15, 2024 at 1:57 PM Carl Edquist wrote: > > the thing discussed in my last email to the list (about > coproc fds being set close-on-exec) makes them unusable for anything > beyond stdin/stdout/stderr. > > [It might sound like an obscure use case, but once you realize what you > can do

Re: Examples of concurrent coproc usage?

2024-04-15 Thread Carl Edquist
On Mon, 15 Apr 2024, Zachary Santer wrote: As much as you can just printf the same thing once for each fd, that doesn't work super well for binary data. Well, you _can_ shovel binary data too: (*) while IFS= read -rd '' X; do printf '%s\0' "$X"; done and use that pattern to make a sh