When running an event, eventd (via run_event) builds a list of scripts to run. run_event gracefully handles the case where it attempts to run a script that has was disabled after the script list was build, provided the script is not a symlink and has been disabled via thee equivalent of chmod -x. In this case, it marks any script that fails with ENOEXEC as DISABLED and it is skipped. However, when working with standard event scripts, CTDB enables them by creating a symlink to a standard installation location. "ctdb event script disable" will unlink a script that was previously linked. When the above race is lost, run_event does not gracefully handle the case where it encounters ENOENT. run_event already maps EACCES to ENOEXEC, so it is easy to also map ENOENT to ENOEXEC.
This bug was referenced in samba master: fee31b6cb2b8f7dd111bdd9d2ff5479c31cbca37
Created attachment 18501 [details] Patch for v4-21-test and v4-20-test Patch for v4-21-test and v4-20-test. Cherry-picks cleanly into v4-21-test. Generated patch applies cleanly to v4-20-test. There may be warnings about introducing trailing whitespace when applying the patch. This is because the test needs to match command output, which has trailing whitespace. Note that I did change/finish a comment line (with trailing whitespace), which is incomplete in the version in master. Sorry about that - I only noticed it when "git am" warned about trailing whitespace... 2 made sense, 1 didn't. I don't think that warrants tagging it as a backport instead of a cherry-pick, since there are no code differences.
Hi Jule, This is ready for v4-20 and v4-21 branches. Amitay.
Pushed to autobuild-v4-{21,20}-test.
This bug was referenced in samba v4-21-test: 9a7047e8cca28605c87536f5085b699d79842432
This bug was referenced in samba v4-20-test: 622bcc55181d4a57266aa659c479ae2e494d6a93
Closing out bug report. Thanks!