[Bug 44126] New: Koha::Script->describe_options: allow scripts to declare deprecated, ignored options
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44126 Bug ID: 44126 Summary: Koha::Script->describe_options: allow scripts to declare deprecated, ignored options Initiative type: --- Sponsorship --- status: Product: Koha Version: Main Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: Command-line Utilities Assignee: koha-bugs@lists.koha-community.org Reporter: martin.renvoize@openfifth.co.uk QA Contact: testopia@bugs.koha-community.org CC: jake.deery@openfifth.co.uk, robin@catalyst.net.nz Target Milestone: --- Scripts converted to Getopt::Long::Descriptive (see bug 43546) now exit 1 on any unknown option. Plain Getopt::Long only printed an "Unknown option" warning, and scripts that did not check the return value of GetOptions carried on regardless. Where a script has dropped an option in the past (for example update_totalissues.pl and --commit, removed in 24.11), existing cron jobs that still pass it used to keep working with a warning. After conversion they exit 1 before doing any work, and since cron lines commonly redirect output to /dev/null, the failure is silent. This bug adds an opt-in 'deprecated_options' key to the meta hash of Koha::Script->describe_options. Each listed option (with or without a value) is stripped from @ARGV before parsing and a deprecation warning is printed to STDERR, in the same way as the existing legacy single-dash compatibility shim. Every other unknown option stays fatal, so typos on destructive scripts are still caught. Test plan: 1. Apply the patch and run prove t/Koha/Script.t 2. Confirm the new tests pass: a declared deprecated option is ignored with a warning, with and without a value (--foo, --foo=1, --foo 1), and an undeclared unknown option still exits 1. -- 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=44126 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |43560 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43560 [Bug 43560] Convert misc/cronjobs/update_totalissues.pl to the Getopt::Long::Descriptive convention (see bug 43546) -- 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=44126 --- Comment #1 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 211734 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=211734&action=edit Bug 44126: Allow scripts to declare deprecated, ignored options in Koha::Script Scripts converted to Getopt::Long::Descriptive (bug 43546) exit 1 on any unknown option. Plain Getopt::Long only warned, so a script that did not check the result of GetOptions carried on. Where a script has dropped an option in the past, existing cron jobs still passing it would now silently stop running (their output is usually sent to /dev/null). Add an opt-in deprecated_options key to the describe_options meta hash, taking option specs such as 'commit=i'. Each such option (and its value) is removed from the command line with a deprecation warning on STDERR, as the legacy single-dash shim does. Everything else that is not a declared option stays an error, so typos are still caught. To test: 1. prove t/Koha/Script.t => Success Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> -- 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=44126 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |martin.renvoize@openfifth.c |ity.org |o.uk Status|NEW |Needs Signoff -- 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=44126 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- QA Contact|testopia@bugs.koha-communit |pedro.amorim@openfifth.co.u |y.org |k -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44126 --- Comment #2 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created as a 'follow-up' to bug 43560 but extracted to beneath it in the dependency tree so other scripts that need it can get it independently of that bug and so this bug gets it's own clear release notes. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44126 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |43557 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43557 [Bug 43557] Add declarative mutually-exclusive option support to Koha::Script->describe_options -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44126 Andrew Fuerste-Henry <andrew@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=44126 Andrew Fuerste-Henry <andrew@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #211734|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=44126 --- Comment #3 from Andrew Fuerste-Henry <andrew@bywatersolutions.com> --- Created attachment 211738 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=211738&action=edit Bug 44126: Allow scripts to declare deprecated, ignored options in Koha::Script Scripts converted to Getopt::Long::Descriptive (bug 43546) exit 1 on any unknown option. Plain Getopt::Long only warned, so a script that did not check the result of GetOptions carried on. Where a script has dropped an option in the past, existing cron jobs still passing it would now silently stop running (their output is usually sent to /dev/null). Add an opt-in deprecated_options key to the describe_options meta hash, taking option specs such as 'commit=i'. Each such option (and its value) is removed from the command line with a deprecation warning on STDERR, as the legacy single-dash shim does. Everything else that is not a declared option stays an error, so typos are still caught. To test: 1. prove t/Koha/Script.t => Success Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44126 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA --- Comment #4 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- OK.. as Andrew flew in and tested this I'm setting it to PQA and unblocking the one that was PQA until Pedro spotted the issue that resulted in this bug.. back to Pedro's queue to hopefully get both in. -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org