Bug#1059400: kubetail: Broken on Debian Bookworm ("syntax error near unexpected token") due to Bash 5.2 incompatibility

2023-12-24 Thread Joan Bruguera Micó
Package: kubetail
Version: 1.6.5-2
Severity: important
Tags: upstream

Dear Maintainer,

Unfortunately, attempting to use kubetail fails on Debian Bookworm.
In particular, any trivial use reports a "syntax error", as follows:

```
$ kubetail nginx
Will tail 2 logs...
nginx-deployment-7c79c4bf97-jdmkg
nginx-deployment-7c79c4bf97-p7bxr
/usr/bin/kubetail: eval: line 326: syntax error near unexpected token `kubectl'
/usr/bin/kubetail: eval: line 326: `kubectl  logs 
nginx-deployment-7c79c4bf97-jdmkg nginx -f=true --since=10s --tail=-1| 
while read -r; do echo "[nginx-deployment-7c79c4bf97-jdmkg] $REPLY " | tail -n 
+1; done  kubectl  logs nginx-deployment-7c79c4bf97-p7bxr nginx -f=true 
--since=10s --tail=-1| while read -r; do echo 
"[nginx-deployment-7c79c4bf97-p7bxr] $REPLY " | tail -n +1; done'
```

This error has been reported and fixed upstream, with the root cause
being a breaking change in Bash 5.2, the version used in Bookworm.
Upstream issue: https://github.com/johanhaleby/kubetail/issues/133

A fix for this issue has been merged in Kubetail 1.6.17:
https://github.com/johanhaleby/kubetail/pull/134

I'd be grateful if the version in Debian Bookworm can be updated or
include the fix above, as otherwise the package can not be used unless
one resolts to any of the workarounds published in the upstream issue.

Regards.

-- System Information:
Debian Release: 12.4
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable-security'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 6.7.0-rc6-1001-mainline-git-00303-g3f82f1c3a036 (SMP w/16 CPU 
threads; PREEMPT)
Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_OOT_MODULE, 
TAINT_UNSIGNED_MODULE
Locale: LANG=C, LC_CTYPE=C.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: unable to detect

-- no debconf information



Re: Obscure issue with process substitution since bash-5.0.016 upgrade

2020-04-03 Thread Joan Bruguera Micó
Thanks for your attention and the provided reduced patch. I can
confirm that, applied over bash-5.0.16, this solves my issue, both on
the test case as well as the bigger application from which it was
extracted.

Regards,
- Joan Bruguera

On Thu, 2 Apr 2020 at 23:20, Chet Ramey  wrote:
>
> On 4/1/20 10:15 PM, Joan Bruguera Micó wrote:
> > I'm having a problem with a script that used to work, which I reduced
> > to the following test case:
> >
> > #!/bin/bash
> >
> > function docat() {
> > for x in 1 2 3 ; do true; done
> > cat "$@"
> > }
> >
> > for x in $(seq 25); do
> > docat <(echo a) <(echo a) <(echo a) <(echo a) <(echo a) <(echo a)
> > done
> >
> > Expected behaviour: A lot of lines with an "a" are printed
>
> Thanks for the report.
>
> Yes, this is a problem, as you discovered, with bash-5.0 patch 16. There is
> a better way to solve the problem that patch attempts to solve, and the
> enclosed patch to bash-5.0.16 does it.
>
> Chet
>
> --
> ``The lyf so short, the craft so long to lerne.'' - Chaucer
>  ``Ars longa, vita brevis'' - Hippocrates
> Chet Ramey, UTech, CWRUc...@case.eduhttp://tiswww.cwru.edu/~chet/



-- 

Joan Bruguera Micó - PGP key id: 88A7 A061 6B47 0CE1 EB4E  D431 8744
44D1 21CE B72E



Re: Obscure issue with process substitution since bash-5.0.016 upgrade

2020-04-01 Thread Joan Bruguera Micó
Apologies, since after reading the other bug report more thoroughly, I
understood that a fix for that issue has actually already been commited to
the devel branch at this point, and indeed, I can also not reproduce my
issue on the latest snapshot. So it looks like this has already been
addressed.

Therefore, ignore my previous email and consider this solved.

Regards,
- Joan Bruguera



On Thu, 2 Apr 2020 at 04:15, Joan Bruguera Micó 
wrote:

> I'm having a problem with a script that used to work, which I reduced
> to the following test case:
>
> #!/bin/bash
>
> function docat() {
> for x in 1 2 3 ; do true; done
> cat "$@"
> }
>
> for x in $(seq 25); do
> docat <(echo a) <(echo a) <(echo a) <(echo a) <(echo a) <(echo a)
> done
>
> Expected behaviour: A lot of lines with an "a" are printed
>
> Actual behaviour: Some lines with an "a" are printed but a lot of
> prints fail with an error:
>
> [...]
> a
> cat: /dev/fd/63: No such file or directory
> cat: /dev/fd/62: No such file or directory
> cat: /dev/fd/61: No such file or directory
> cat: /dev/fd/60: No such file or directory
> a
> [...]
>
> Now if you remove the apparently useless for loop in the first line of
> docat, this works as I would expect. It also works on zsh.
>
> After some head banging I found that what makes the difference is the
> latest bash update, bash-5.0.016. On bash-5.0.015 this script works,
> so the the patch that makes the difference is this one:
> https://ftp.gnu.org/gnu/bash/bash-5.0-patches/bash50-016
>
> Was the script technically wrong but worked due to some bash
> implementation detail, or is this could actually a problem with bash?
>
> I found a very similar report in
> https://lists.gnu.org/archive/html/bug-bash/2020-03/msg00062.html ,
> but I'm not sure if it's the same underlying issue, since that
> particular case is said to be introduced between 4.4-5.0, and this one
> is between 5.0.015-5.0.016, and no fix is yet available to test.
>
> Thanks for your help,
> - Joan Bruguera
>
> PS: This is the first time I post to the mailing list, so preemptive
> apologies for any mistake I could have made.
>


-- 

*Joan Bruguera Micó* - PGP key id: 88A7 A061 6B47 0CE1 EB4E  D431 8744 44D1
21CE B72E


Obscure issue with process substitution since bash-5.0.016 upgrade

2020-04-01 Thread Joan Bruguera Micó
I'm having a problem with a script that used to work, which I reduced
to the following test case:

#!/bin/bash

function docat() {
for x in 1 2 3 ; do true; done
cat "$@"
}

for x in $(seq 25); do
docat <(echo a) <(echo a) <(echo a) <(echo a) <(echo a) <(echo a)
done

Expected behaviour: A lot of lines with an "a" are printed

Actual behaviour: Some lines with an "a" are printed but a lot of
prints fail with an error:

[...]
a
cat: /dev/fd/63: No such file or directory
cat: /dev/fd/62: No such file or directory
cat: /dev/fd/61: No such file or directory
cat: /dev/fd/60: No such file or directory
a
[...]

Now if you remove the apparently useless for loop in the first line of
docat, this works as I would expect. It also works on zsh.

After some head banging I found that what makes the difference is the
latest bash update, bash-5.0.016. On bash-5.0.015 this script works,
so the the patch that makes the difference is this one:
https://ftp.gnu.org/gnu/bash/bash-5.0-patches/bash50-016

Was the script technically wrong but worked due to some bash
implementation detail, or is this could actually a problem with bash?

I found a very similar report in
https://lists.gnu.org/archive/html/bug-bash/2020-03/msg00062.html ,
but I'm not sure if it's the same underlying issue, since that
particular case is said to be introduced between 4.4-5.0, and this one
is between 5.0.015-5.0.016, and no fix is yet available to test.

Thanks for your help,
- Joan Bruguera

PS: This is the first time I post to the mailing list, so preemptive
apologies for any mistake I could have made.