[PATCH for-4.21 2/2] cirrus-ci: fix bashism in the test_script code

Roger Pau Monne posted 2 patches 3 weeks, 2 days ago
There is a newer version of this series
[PATCH for-4.21 2/2] cirrus-ci: fix bashism in the test_script code
Posted by Roger Pau Monne 3 weeks, 2 days ago
The default shell in FreeBSD is plain sh, which doesn't support the usage
of the '|&' operator:

./automation/scripts/console.exp |& sed 's/\r\+$//'
/tmp/scripts34c427adc6599db29cb91221a0939d85.sh: 16: Syntax error: "&" unexpected

Fix this by using a redirection of stderr into stdout, and then a pipe.

Fixes: a406195c15dd ("automation: call expect script with redirected standard error")
Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
---
 .cirrus.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.cirrus.yml b/.cirrus.yml
index 55dc9b39092a..2fa1deeeafc1 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -169,7 +169,7 @@ task:
     export TEST_LOG="serial-${FREEBSD_BUILD}-${XTF_ARCH}.txt"
     export PASSED="Test result: SUCCESS"
     export TEST_TIMEOUT=120
-    ./automation/scripts/console.exp |& sed 's/\r\+$//'
+    ./automation/scripts/console.exp 2>&1 | sed 's/\r\+$//'
 
   always:
     serial_artifacts:
-- 
2.51.0


Re: [PATCH for-4.21 2/2] cirrus-ci: fix bashism in the test_script code
Posted by Andrew Cooper 3 weeks, 2 days ago
On 06/10/2025 8:07 pm, Roger Pau Monne wrote:
> The default shell in FreeBSD is plain sh, which doesn't support the usage
> of the '|&' operator:
>
> ./automation/scripts/console.exp |& sed 's/\r\+$//'
> /tmp/scripts34c427adc6599db29cb91221a0939d85.sh: 16: Syntax error: "&" unexpected
>
> Fix this by using a redirection of stderr into stdout, and then a pipe.
>
> Fixes: a406195c15dd ("automation: call expect script with redirected standard error")
> Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>

Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>

It's sad that this slipped in because the CirrusCI runs were reliably
broken by the libinotify issue.

~Andrew