[Bug 25634] New: koha-foreach exits if 1 command has non-zero status
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25634 Bug ID: 25634 Summary: koha-foreach exits if 1 command has non-zero status Change sponsored?: --- Product: Koha Version: unspecified Hardware: All OS: All Status: NEW Severity: normal Priority: P5 - low Component: Architecture, internals, and plumbing Assignee: koha-bugs@lists.koha-community.org Reporter: dcook@prosentient.com.au QA Contact: testopia@bugs.koha-community.org In 19.11.05 (and certainly other versions affected by Bug 17532), koha-foreach will exit early if 1 command for 1 instance has a non-zero status. It seems to me that we should warn on a failure, but we should continue the for loop, because the failure could be instance (rather than system) specific. In my case, /usr/share/koha/bin/cronjobs/overdue_notices.pl isn't running for most instances, because one of the instances starting with A is encountering this error: "No branches with active overduerules at /usr/share/koha/bin/cronjobs/overdue_notices.pl line 347". While I'll address that individually, it's an unfortunate consequence of Bug 17532 to ditch out early. I'm thinking the easiest solution would be to remove "set -e" from koha-foreach, and warn on individual failures. -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25634 David Cook <dcook@prosentient.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |17532 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17532 [Bug 17532] koha-shell -c does not propagate the error code -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25634 David Cook <dcook@prosentient.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|koha-foreach exits if 1 |koha-foreach exits too |command has non-zero status |early if any command has | |non-zero status -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25634 David Cook <dcook@prosentient.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://bugs.koha-community | |.org/bugzilla3/show_bug.cgi | |?id=25635 -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25634 --- Comment #1 from David Cook <dcook@prosentient.com.au> --- I suppose there might be times where you want a koha-foreach to die if any command fails, but perhaps we should add a flag to koha-foreach for that scenario... -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25634 David Cook <dcook@prosentient.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |dcook@prosentient.com.au |ity.org | -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25634 David Cook <dcook@prosentient.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Patch complexity|--- |Small patch Status|NEW |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25634 --- Comment #2 from David Cook <dcook@prosentient.com.au> --- Created attachment 105453 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=105453&action=edit Bug 25634: Warn if koha-shell returns non-zero in koha-foreach By putting koha-shell in an if statement, "set -e" will no longer cause the entire koha-foreach program to exit, if koha-shell returns a non-zero status. If a non-zero status is returned, we warn on it, and the caller of koha-foreach can interpret that command visually. To Test: 1) Write a shell script that says "Hello" and then exits with a 1 status 2) Run koha-foreach against that shell script with multiple instances available to koha-foreach 3) Before the patch, koha-foreach will die after the first "Hello" 4) After the patch, koha-foreach will continue, through all the instances, and report which instances returned non-zero statuses by which command. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25634 --- Comment #3 from David Cook <dcook@prosentient.com.au> --- (In reply to David Cook from comment #0)
I'm thinking the easiest solution would be to remove "set -e" from koha-foreach, and warn on individual failures.
Actually, the easiest solution was to wrap koha-shell in an if statement ad just warn on what instance and command return a non-zero status. "set -e" won't exit if the non-zero status is returned by a command wrapped by an if statement. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25634 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jonathan.druart@bugs.koha-c | |ommunity.org --- Comment #4 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- I agree, should not we display the error code? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25634 --- Comment #5 from David Cook <dcook@prosentient.com.au> --- (In reply to Jonathan Druart from comment #4)
I agree, should not we display the error code?
Mmm good point. I'll add an alternative patch. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25634 --- Comment #6 from David Cook <dcook@prosentient.com.au> --- Created attachment 105478 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=105478&action=edit Bug 25634: [Alternate] Warn if koha-shell returns non-zero in koha-foreach By putting koha-shell in an if statement, "set -e" will no longer cause the entire koha-foreach program to exit, if koha-shell returns a non-zero status. If a non-zero status is returned, we warn on it, and the caller of koha-foreach can interpret that command visually. To Test: 1) Write a shell script that says "Hello" and then exits with a 1 status 2) Run koha-foreach against that shell script with multiple instances available to koha-foreach 3) Before the patch, koha-foreach will die after the first "Hello" 4) After the patch, koha-foreach will continue, through all the instances, and report which instances returned non-zero statuses by which command. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25634 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #105453|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25634 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Severity|normal |major -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25634 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25634 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #105478|0 |1 is obsolete| | --- Comment #7 from Kyle M Hall <kyle@bywatersolutions.com> --- Created attachment 105636 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=105636&action=edit Bug 25634: [Alternate] Warn if koha-shell returns non-zero in koha-foreach By putting koha-shell in an if statement, "set -e" will no longer cause the entire koha-foreach program to exit, if koha-shell returns a non-zero status. If a non-zero status is returned, we warn on it, and the caller of koha-foreach can interpret that command visually. To Test: 1) Write a shell script that says "Hello" and then exits with a 1 status 2) Run koha-foreach against that shell script with multiple instances available to koha-foreach 3) Before the patch, koha-foreach will die after the first "Hello" 4) After the patch, koha-foreach will continue, through all the instances, and report which instances returned non-zero statuses by which command. Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25634 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #105636|0 |1 is obsolete| | --- Comment #8 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Created attachment 105648 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=105648&action=edit Bug 25634: [Alternate] Warn if koha-shell returns non-zero in koha-foreach By putting koha-shell in an if statement, "set -e" will no longer cause the entire koha-foreach program to exit, if koha-shell returns a non-zero status. If a non-zero status is returned, we warn on it, and the caller of koha-foreach can interpret that command visually. To Test: 1) Write a shell script that says "Hello" and then exits with a 1 status 2) Run koha-foreach against that shell script with multiple instances available to koha-foreach 3) Before the patch, koha-foreach will die after the first "Hello" 4) After the patch, koha-foreach will continue, through all the instances, and report which instances returned non-zero statuses by which command. Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25634 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |martin.renvoize@ptfs-europe | |.com Status|Signed Off |Passed QA --- Comment #9 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Works as expected, thanks. Passing QA -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25634 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Version(s)| |20.11.00 released in| | Status|Passed QA |Pushed to master -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25634 --- Comment #10 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Pushed to master for 20.11, thanks to everybody involved! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25634 Lucas Gass <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Version(s)|20.11.00 |20.11.00, 20.05.01 released in| | CC| |lucas@bywatersolutions.com Status|Pushed to master |Pushed to stable --- Comment #11 from Lucas Gass <lucas@bywatersolutions.com> --- backported to 20.05.x for 20.05.01 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25634 Aleisha Amohia <aleisha@catalyst.net.nz> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to stable |Pushed to oldstable Version(s)|20.11.00, 20.05.01 |20.11.00, 20.05.01, released in| |19.11.07 CC| |aleisha@catalyst.net.nz --- Comment #12 from Aleisha Amohia <aleisha@catalyst.net.nz> --- backported to 19.11.x for 19.11.07 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25634 Victor Grousset/tuxayo <victor@tuxayo.net> changed: What |Removed |Added ---------------------------------------------------------------------------- Version(s)|20.11.00, 20.05.01, |20.11.00, 20.05.01, released in|19.11.07 |19.11.07, 19.05.12 CC| |victor@tuxayo.net -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25634 Victor Grousset/tuxayo <victor@tuxayo.net> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to oldstable |Pushed to oldoldstable --- Comment #13 from Victor Grousset/tuxayo <victor@tuxayo.net> --- Backported to 19.05.x branch for 19.05.12 -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org