[Bug 43552] New: Convert misc/cronjobs/gather_print_notices.pl to the Getopt::Long::Descriptive convention (see bug 43546)
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43552 Bug ID: 43552 Summary: Convert misc/cronjobs/gather_print_notices.pl to the Getopt::Long::Descriptive convention (see bug 43546) 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 Depends on: 43546 Target Milestone: --- This is one of a set of bugs filed alongside bug 43546 (Standardize command-line scripts on Getopt::Long::Descriptive) to convert individual, commonly-used cron scripts to whatever declarative option-parsing convention that bug settles on. Depends on 43546. Current state: gather_print_notices.pl uses plain Getopt::Long (GetOptions call around line 31). No named option is required in the Getopt::Long sense. The actual mandatory input is a positional argument, not a flag: the output directory is taken from $ARGV[0] and validated around line 47 ("You must specify a valid and writeable directory..."). Separately, --csv and --ods each require exactly one --letter_code to also be given -- a cross-option constraint, not a single required flag. What this bug covers: convert the named options (--split, --html, --csv, --ods, --delimiter, --letter_code, --send, --email) to the new convention for consistency. As with runreport.pl in this same set, the positional output-directory requirement and the csv/ods-needs-one-letter_code cross-check don't map onto a simple per-option required constraint and will likely need to stay as manual post-parse validation. Test plan: - --help output covers all documented options and matches current behavior - Running with a valid output directory and various flag combinations still behaves exactly as before - Running with a missing/invalid directory, or --csv/--ods without exactly one --letter_code, still fails with the same errors as today Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43546 [Bug 43546] Standardize command-line scripts on Getopt::Long::Descriptive for safer, more consistent option handling -- 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=43552 --- Comment #1 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 206184 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=206184&action=edit Bug 43552: Convert gather_print_notices.pl to the Getopt::Long::Descriptive convention Convert the plain Getopt::Long option parsing to Koha::Script->describe_options, per the convention established by bug 43546. The mandatory output_directory is a positional argument, not a named option, so it uses the args => { min => 1 } support added on bug 43546's follow-up, replacing the hand-rolled "no reportID" style check with a consistent one. Two checks stay as post-parse code, same reasoning as the sibling bugs in this set: - output_directory must exist and be writeable: a filesystem-state check, not a CLI-shape one. - --csv/--ods must be combined with exactly one --letter_code: not a simple mutual-exclusivity pair (Koha::Script's exclusive support from bug 43557 doesn't fit), and not a single-option shape check either. --send's existing Getopt::Long negatable flag (send!) carries over directly; describe_options renders it as --[no-]send in --help for free. One minor, expected loss consistent with the other scripts converted so far: -h no longer means --help (describe_options' auto-added help is always help|?, no short letter); updated the SYNOPSIS/OPTIONS POD to stop advertising it. Test plan: 1. gather_print_notices.pl --help / --man 2. gather_print_notices.pl (no output_directory) Rejected: at least 1 output_directory argument required. 3. gather_print_notices.pl /no/such/dir Rejected: must specify a valid and writeable directory. 4. gather_print_notices.pl --csv /tmp/some-writeable-dir Rejected: --csv needs exactly one --letter_code. 5. gather_print_notices.pl /tmp/some-writeable-dir Runs to completion (default html format). 6. koha-qa.pl passes. -- 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=43552 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 the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43552 Alex Carver [Acerock7] <alex@rcls.org> 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=43552 Alex Carver [Acerock7] <alex@rcls.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #206184|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=43552 --- Comment #2 from Alex Carver [Acerock7] <alex@rcls.org> --- Created attachment 207422 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=207422&action=edit Bug 43552: Convert gather_print_notices.pl to the Getopt::Long::Descriptive convention Convert the plain Getopt::Long option parsing to Koha::Script->describe_options, per the convention established by bug 43546. The mandatory output_directory is a positional argument, not a named option, so it uses the args => { min => 1 } support added on bug 43546's follow-up, replacing the hand-rolled "no reportID" style check with a consistent one. Two checks stay as post-parse code, same reasoning as the sibling bugs in this set: - output_directory must exist and be writeable: a filesystem-state check, not a CLI-shape one. - --csv/--ods must be combined with exactly one --letter_code: not a simple mutual-exclusivity pair (Koha::Script's exclusive support from bug 43557 doesn't fit), and not a single-option shape check either. --send's existing Getopt::Long negatable flag (send!) carries over directly; describe_options renders it as --[no-]send in --help for free. One minor, expected loss consistent with the other scripts converted so far: -h no longer means --help (describe_options' auto-added help is always help|?, no short letter); updated the SYNOPSIS/OPTIONS POD to stop advertising it. Test plan: 1. gather_print_notices.pl --help / --man 2. gather_print_notices.pl (no output_directory) Rejected: at least 1 output_directory argument required. 3. gather_print_notices.pl /no/such/dir Rejected: must specify a valid and writeable directory. 4. gather_print_notices.pl --csv /tmp/some-writeable-dir Rejected: --csv needs exactly one --letter_code. 5. gather_print_notices.pl /tmp/some-writeable-dir Runs to completion (default html format). 6. koha-qa.pl passes. Signed-off-by: Alex Carver [Acerock7] <alex@rcls.org> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43552 Andrew Fuerste-Henry <andrew@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA QA Contact|testopia@bugs.koha-communit |andrew@bywatersolutions.com |y.org | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43552 Andrew Fuerste-Henry <andrew@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #207422|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=43552 --- Comment #3 from Andrew Fuerste-Henry <andrew@bywatersolutions.com> --- Created attachment 208044 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=208044&action=edit Bug 43552: Convert gather_print_notices.pl to the Getopt::Long::Descriptive convention Convert the plain Getopt::Long option parsing to Koha::Script->describe_options, per the convention established by bug 43546. The mandatory output_directory is a positional argument, not a named option, so it uses the args => { min => 1 } support added on bug 43546's follow-up, replacing the hand-rolled "no reportID" style check with a consistent one. Two checks stay as post-parse code, same reasoning as the sibling bugs in this set: - output_directory must exist and be writeable: a filesystem-state check, not a CLI-shape one. - --csv/--ods must be combined with exactly one --letter_code: not a simple mutual-exclusivity pair (Koha::Script's exclusive support from bug 43557 doesn't fit), and not a single-option shape check either. --send's existing Getopt::Long negatable flag (send!) carries over directly; describe_options renders it as --[no-]send in --help for free. One minor, expected loss consistent with the other scripts converted so far: -h no longer means --help (describe_options' auto-added help is always help|?, no short letter); updated the SYNOPSIS/OPTIONS POD to stop advertising it. Test plan: 1. gather_print_notices.pl --help / --man 2. gather_print_notices.pl (no output_directory) Rejected: at least 1 output_directory argument required. 3. gather_print_notices.pl /no/such/dir Rejected: must specify a valid and writeable directory. 4. gather_print_notices.pl --csv /tmp/some-writeable-dir Rejected: --csv needs exactly one --letter_code. 5. gather_print_notices.pl /tmp/some-writeable-dir Runs to completion (default html format). 6. koha-qa.pl passes. Signed-off-by: Alex Carver [Acerock7] <alex@rcls.org> 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=43552 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #208044|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=43552 --- Comment #4 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 208586 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=208586&action=edit Bug 43552: Convert gather_print_notices.pl to the Getopt::Long::Descriptive convention Convert the plain Getopt::Long option parsing to Koha::Script->describe_options, per the convention established by bug 43546. The mandatory output_directory is a positional argument, not a named option, so it uses the args => { min => 1 } support added on bug 43546's follow-up, replacing the hand-rolled "no reportID" style check with a consistent one. Two checks stay as post-parse code, same reasoning as the sibling bugs in this set: - output_directory must exist and be writeable: a filesystem-state check, not a CLI-shape one. - --csv/--ods must be combined with exactly one --letter_code: not a simple mutual-exclusivity pair (Koha::Script's exclusive support from bug 43557 doesn't fit), and not a single-option shape check either. --send's existing Getopt::Long negatable flag (send!) carries over directly; describe_options renders it as --[no-]send in --help for free. One minor, expected loss consistent with the other scripts converted so far: -h no longer means --help (describe_options' auto-added help is always help|?, no short letter); updated the SYNOPSIS/OPTIONS POD to stop advertising it. Test plan: 1. gather_print_notices.pl --help / --man 2. gather_print_notices.pl (no output_directory) Rejected: at least 1 output_directory argument required. 3. gather_print_notices.pl /no/such/dir Rejected: must specify a valid and writeable directory. 4. gather_print_notices.pl --csv /tmp/some-writeable-dir Rejected: --csv needs exactly one --letter_code. 5. gather_print_notices.pl /tmp/some-writeable-dir Runs to completion (default html format). 6. koha-qa.pl passes. Signed-off-by: Alex Carver [Acerock7] <alex@rcls.org> 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=43552 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #208586|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=43552 --- Comment #5 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 208601 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=208601&action=edit Bug 43552: Convert gather_print_notices.pl to the Getopt::Long::Descriptive convention Convert the plain Getopt::Long option parsing to Koha::Script->describe_options, per the convention established by bug 43546. The mandatory output_directory is a positional argument, not a named option, so it uses the args => { min => 1 } support added on bug 43546's follow-up, replacing the hand-rolled "no reportID" style check with a consistent one. Two checks stay as post-parse code, same reasoning as the sibling bugs in this set: - output_directory must exist and be writeable: a filesystem-state check, not a CLI-shape one. - --csv/--ods must be combined with exactly one --letter_code: not a simple mutual-exclusivity pair (Koha::Script's exclusive support from bug 43557 doesn't fit), and not a single-option shape check either. --send's existing Getopt::Long negatable flag (send!) carries over directly; describe_options renders it as --[no-]send in --help for free. One minor, expected loss consistent with the other scripts converted so far: -h no longer means --help (describe_options' auto-added help is always help|?, no short letter); updated the SYNOPSIS/OPTIONS POD to stop advertising it. Test plan: 1. gather_print_notices.pl --help / --man 2. gather_print_notices.pl (no output_directory) Rejected: at least 1 output_directory argument required. 3. gather_print_notices.pl /no/such/dir Rejected: must specify a valid and writeable directory. 4. gather_print_notices.pl --csv /tmp/some-writeable-dir Rejected: --csv needs exactly one --letter_code. 5. gather_print_notices.pl /tmp/some-writeable-dir Runs to completion (default html format). 6. koha-qa.pl passes. Signed-off-by: Alex Carver [Acerock7] <alex@rcls.org> 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=43552 Pedro Amorim (ammopt) <pedro.amorim@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |pedro.amorim@openfifth.co.u | |k Status|Passed QA |Failed QA --- Comment #6 from Pedro Amorim (ammopt) <pedro.amorim@openfifth.co.uk> --- See bug 43550, same issue here: e.g. -split, -html, -nosend and -csv -letter_code=X now fail with "Unknown option", while the double-dash forms work. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43552 Pedro Amorim (ammopt) <pedro.amorim@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=43552 --- Comment #7 from Pedro Amorim (ammopt) <pedro.amorim@openfifth.co.uk> --- Hi all, with bug 43557 applied, my previous FQA comment is no longer applicable, but -nosend (single dash) still breaks: Before this patch: misc/cronjobs/gather_print_notices.pl /tmp -nosend => works After this patch (with 43557): misc/cronjobs/gather_print_notices.pl /tmp -nosend => fails with "Unknown option: n" --nosend (double dash) works in both cases. The 43557 shim doesn't cover the "no" form of options like --send, so it probably needs a follow-up there. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43552 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #208601|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=43552 --- Comment #8 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 210814 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=210814&action=edit Bug 43552: Convert gather_print_notices.pl to the Getopt::Long::Descriptive convention Convert the plain Getopt::Long option parsing to Koha::Script->describe_options, per the convention established by bug 43546. The mandatory output_directory is a positional argument, not a named option, so it uses the args => { min => 1 } support added on bug 43546's follow-up, replacing the hand-rolled "no reportID" style check with a consistent one. Two checks stay as post-parse code, same reasoning as the sibling bugs in this set: - output_directory must exist and be writeable: a filesystem-state check, not a CLI-shape one. - --csv/--ods must be combined with exactly one --letter_code: not a simple mutual-exclusivity pair (Koha::Script's exclusive support from bug 43557 doesn't fit), and not a single-option shape check either. --send's existing Getopt::Long negatable flag (send!) carries over directly; describe_options renders it as --[no-]send in --help for free. One minor, expected loss consistent with the other scripts converted so far: -h no longer means --help (describe_options' auto-added help is always help|?, no short letter); updated the SYNOPSIS/OPTIONS POD to stop advertising it. Test plan: 1. gather_print_notices.pl --help / --man 2. gather_print_notices.pl (no output_directory) Rejected: at least 1 output_directory argument required. 3. gather_print_notices.pl /no/such/dir Rejected: must specify a valid and writeable directory. 4. gather_print_notices.pl --csv /tmp/some-writeable-dir Rejected: --csv needs exactly one --letter_code. 5. gather_print_notices.pl /tmp/some-writeable-dir Runs to completion (default html format). 6. koha-qa.pl passes. Signed-off-by: Alex Carver [Acerock7] <alex@rcls.org> 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=43552 --- Comment #9 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 210815 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=210815&action=edit Bug 43552: (follow-up) Accept -nosend and -no-send for negatable options in the legacy shim Koha::Script->describe_options rewrites the single-dash long options that plain Getopt::Long accepted (e.g. -days) as the standard --days, with a deprecation warning. It did not know the negated form of a negatable option such as send!, so -nosend (and -no-send) were no longer accepted, and failed with "Unknown option: n" as a bundle of one-character flags. This broke existing command lines such as 'gather_print_notices.pl /dir -nosend'. A negatable long option is now also accepted as -no<name> and -no-<name>, rewritten as --no-<name>, with the same deprecation warning. Only those exact spellings are accepted: a prefix does not resolve to a negated form, and the negated form of an option that is not negatable is still an error. To test: 1. Apply the patches 2. Run $ ktd --shell k$ prove t/Koha/Script.t => SUCCESS: Tests pass! 3. Without the Koha/Script.pm change, the new tests fail 4. misc/cronjobs/gather_print_notices.pl /tmp -nosend => Runs, with a warning that -nosend is deprecated, use --no-send 5. misc/cronjobs/gather_print_notices.pl /tmp --nosend => Runs, without a warning 6. Sign off :-D Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43552 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Failed QA |Signed Off --- Comment #10 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Thanks Pedro, good catch. The cause is in the single-dash shim of Koha::Script->describe_options (bug 43557): it rewrote -long as --long, but did not know the negated form of a negatable option such as send!, so -nosend was left alone and parsed as a bundle of one-character flags, hence 'Unknown option: n'. The new follow-up patch makes the shim accept -no<name> and -no-<name> for negatable options, rewriting them as --no-<name> with the same deprecation warning. A prefix does not resolve to a negated form, and the negated form of an option that is not negatable is still an error. It touches Koha::Script, so the other converted scripts benefit too. Tests added to t/Koha/Script.t; they fail without the change. I checked the script itself: 'gather_print_notices.pl /tmp -nosend', '-split -html -nosend' and '-csv -letter_code=X -nosend' all run again, with the deprecation warning, and --nosend runs without one. Both patches are re-attached, rebased on current main, with the signed-off-by lines kept. Setting back to Signed Off for another look. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43552 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on|43546 | Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43546 [Bug 43546] Standardize command-line scripts on Getopt::Long::Descriptive for safer, more consistent option handling -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43552 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43552 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #210814|0 |1 is obsolete| | Attachment #210815|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=43552 --- Comment #11 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 210820 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=210820&action=edit Bug 43552: Convert gather_print_notices.pl to the Getopt::Long::Descriptive convention Convert the plain Getopt::Long option parsing to Koha::Script->describe_options, per the convention established by bug 43546. The mandatory output_directory is a positional argument, not a named option, so it uses the args => { min => 1 } support added on bug 43546's follow-up, replacing the hand-rolled "no reportID" style check with a consistent one. Two checks stay as post-parse code, same reasoning as the sibling bugs in this set: - output_directory must exist and be writeable: a filesystem-state check, not a CLI-shape one. - --csv/--ods must be combined with exactly one --letter_code: not a simple mutual-exclusivity pair (Koha::Script's exclusive support from bug 43557 doesn't fit), and not a single-option shape check either. --send's existing Getopt::Long negatable flag (send!) carries over directly; describe_options renders it as --[no-]send in --help for free. One minor, expected loss consistent with the other scripts converted so far: -h no longer means --help (describe_options' auto-added help is always help|?, no short letter); updated the SYNOPSIS/OPTIONS POD to stop advertising it. Test plan: 1. gather_print_notices.pl --help / --man 2. gather_print_notices.pl (no output_directory) Rejected: at least 1 output_directory argument required. 3. gather_print_notices.pl /no/such/dir Rejected: must specify a valid and writeable directory. 4. gather_print_notices.pl --csv /tmp/some-writeable-dir Rejected: --csv needs exactly one --letter_code. 5. gather_print_notices.pl /tmp/some-writeable-dir Runs to completion (default html format). 6. koha-qa.pl passes. Signed-off-by: Alex Carver [Acerock7] <alex@rcls.org> 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=43552 --- Comment #12 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 210821 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=210821&action=edit Bug 43552: (QA follow-up) Accept -nosend and -no-send for negatable options in the legacy shim Koha::Script->describe_options rewrites the single-dash long options that plain Getopt::Long accepted (e.g. -days) as the standard --days, with a deprecation warning. It did not know the negated form of a negatable option such as send!, so -nosend (and -no-send) were no longer accepted, and failed with "Unknown option: n" as a bundle of one-character flags. This broke existing command lines such as 'gather_print_notices.pl /dir -nosend'. A negatable long option is now also accepted as -no<name> and -no-<name>, rewritten as --no-<name>, with the same deprecation warning. Only those exact spellings are accepted: a prefix does not resolve to a negated form, and the negated form of an option that is not negatable is still an error. To test: 1. Apply the patches 2. Run $ ktd --shell k$ prove t/Koha/Script.t => SUCCESS: Tests pass! 3. Without the Koha/Script.pm change, the new tests fail 4. misc/cronjobs/gather_print_notices.pl /tmp -nosend => Runs, with a warning that -nosend is deprecated, use --no-send 5. misc/cronjobs/gather_print_notices.pl /tmp --nosend => Runs, without a warning 6. Sign off :-D -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43552 --- Comment #13 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- (In reply to Pedro Amorim (ammopt) from comment #7)
... but -nosend (single dash) still breaks
Damn, great spot Pedro! Really glad to have you spotting things like this. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43552 Pedro Amorim (ammopt) <pedro.amorim@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |Pushed to main Version(s)| |26.11.00 released in| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43552 --- Comment #14 from Pedro Amorim (ammopt) <pedro.amorim@openfifth.co.uk> --- Thanks everyone! Pushed to main for 26.11! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43552 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Text to go in the| |The release notes| |`gather_print_notices.pl` | |cronjob now parses its | |options with the shared | |`Koha::Script` option | |handling, and its help text | |is generated from the | |option definitions. | | | |**Configuration** | |- `-h` no longer means | |help; use `--help`. | |- Single-dash long options | |such as `-nosend` still | |work but print a | |deprecation warning. Use | |`--nosend` or `--no-send` | |instead. | | | |**Upgrade notes** | |- Cron lines that use `-h` | |need to be changed to | |`--help`. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43552 Lucas Gass (lukeg) <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |lucas@bywatersolutions.com Status|Pushed to main |Needs documenting --- Comment #15 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- Enhancement, no 26.05.x backport. -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org