Skip to content

fix(hooks): incorrect found count/skipped output in mixed exec/non-exec batches #2551

Merged
J0WI merged 2 commits intomasterfrom
jtr/fix-hooks-nonexec-counter-bug
Mar 29, 2026
Merged

fix(hooks): incorrect found count/skipped output in mixed exec/non-exec batches #2551
J0WI merged 2 commits intomasterfrom
jtr/fix-hooks-nonexec-counter-bug

Conversation

@joshtrichards
Copy link
Copy Markdown
Member

The found variable is incorrectly decremented for non-executable scripts, which leads to misleading output when a hook folder contains an executable + a non-executable script (output will indicate the folder was fully scripted).

Place two scripts in before-starting hook folder: scriptA.sh and scriptB.sh.
Make sure scriptA.sh is properly executable.
Make sure scriptB.sh is not executable.

before:

=> Searching for hook scripts (*.sh) to run, located in the folder "/docker-entrypoint-hooks.d/before-starting"
==> Running the script (cwd: /var/www/html): "/docker-entrypoint-hooks.d/before-starting/scriptA.sh"
hello from scriptA.sh
==> Finished executing the script: "/docker-entrypoint-hooks.d/before-starting/scriptA.sh"
==> The script "/docker-entrypoint-hooks.d/before-starting/scriptB.sh was skipped, because it lacks the executable flag
==> Skipped: the "before-starting" folder does not contain any valid scripts

^^^last line

after:

=> Searching for hook scripts (*.sh) to run, located in the folder "/docker-entrypoint-hooks.d/before-starting"
==> Running the script (cwd: /var/www/html): "/docker-entrypoint-hooks.d/before-starting/scriptA.sh.sh"
hello from scriptA.sh
==> Finished executing the script: "/docker-entrypoint-hooks.d/before-starting/scriptA.sh"
==> The script "/docker-entrypoint-hooks.d/before-starting/scriptB.sh" was skipped, because it lacks the executable flag
=> Completed executing scripts in the "before-starting" folder

The `found` variable is incorrectly decremented for non-executable scripts, which leads to misleading output when a hook folder contains an executable + a non-executable script (output will indicate the folder was fully scripted).

Signed-off-by: Josh <josh.t.richards@gmail.com>
Signed-off-by: Josh <josh.t.richards@gmail.com>
@J0WI J0WI self-requested a review March 29, 2026 00:07
@J0WI J0WI merged commit 583fbe3 into master Mar 29, 2026
22 of 29 checks passed
@J0WI J0WI deleted the jtr/fix-hooks-nonexec-counter-bug branch March 29, 2026 00:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants