From e8dff8139296b06b3bc294bf108f52b79c2ea1c6 Mon Sep 17 00:00:00 2001 From: alexandru-marianlita Date: Thu, 2 Apr 2026 20:30:56 +0000 Subject: [PATCH] fix: broken pipe in change-password help probe (#1052) ### Description of the change This change fixes an intermittent failure in the init password-reset flow caused by the CLI feature probe used to detect `--must-change-password` support. The current probe uses: `gitea admin user change-password --help | grep -qF -- '--must-change-password'` Because `grep -q` exits immediately after the first match, it can close the pipe while gitea is still writing help output. In that case, gitea may return broken pipe. This is timing-dependent, so it only reproduces sometimes with the same binary. This PR replaces that check with a form that consumes the full output before exiting, avoiding premature pipe closure. ### Benefits - Prevents intermittent broken pipe failures during init - Makes password-reset capability detection deterministic ### Applicable issues - Fixes #1051 ### Additional information No test update was required for this change. The fix only adjusts the shell pipeline used in the rendered init script to avoid an intermittent broken pipe during the `--must-change-password` capability check. There are currently no existing Helm or bash unit tests covering this specific command path in the chart, and this change does not alter chart values, rendered resource structure, or template interfaces. ### Checklist - [x] Bash unittests are added (required when changing anything in `scripts` folder) Reviewed-on: https://gitea.com/gitea/helm-gitea/pulls/1052 Co-authored-by: alexandru-marianlita Co-committed-by: alexandru-marianlita --- templates/gitea/init.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/gitea/init.yaml b/templates/gitea/init.yaml index 8927ba7..1bcd4e6 100644 --- a/templates/gitea/init.yaml +++ b/templates/gitea/init.yaml @@ -123,7 +123,7 @@ stringData: # should add it to prevent requiring frequent admin password resets. local -a change_args change_args=(--username "${GITEA_ADMIN_USERNAME}" --password "${GITEA_ADMIN_PASSWORD}") - if gitea admin user change-password --help | grep -qF -- '--must-change-password'; then + if gitea admin user change-password --help | grep -F -- '--must-change-password' >/dev/null; then change_args+=(--must-change-password=false) fi gitea admin user change-password "${change_args[@]}"