Hello All,
Unfortunately, we had some downtime due to a router failure at Hetzner [1].
The side effect of this is aarch64-01 - 05 and x86_64-09/10 are offline.
We have to restart Jenkins to get these back online. Due to there being a
large build queue I will be doing this later today (04/07/2018 at 20:00
UTC).
1. https://www.hetzner-status.de/
Thanks
Ben
Hi Bash Experts!
Every couple of years I stumble upon weird behavior in bash scripts, which I cannot explain, and every time it was due to documented bash behavior. Can, please, someone explain to me why the following script terminates?
I've tried this on Ubuntu 22.04 and Ubuntu 20.04 with same results -- see "Observations" at the end of the script.
Thanks!
===
#!/bin/bash
set -euf -o pipefail
print_test ()
{
local count="$1"
while [ $count -ge 0 ]; do
if [ x"$(echo a)" = x"a" ]; then
echo a
fi
count=$(($count - 1))
done
}
main ()
{
local count=1
while print_test "$count" | grep -q "a"; do
echo "$count: OK"
count=$(($count + 1))
done
echo "$count: BAD"
}
main
exit 1
# Observations:
# 1. With "if" in print_test BAD happens on around count "2"
# 2. Without "if" in print_test BAD happens around count "80"
# 3. Changing "grep -q" to "grep" makes the problem go away.
# 4. Removing -o pipefail makes the problem go away.
# 5. While loop in "main" isn't required, but makes reproduction easier.
===
--
Maxim Kuvyrkov
https://www.linaro.org