[Bug 43330] New: C4::Tags fails to compile when TagsExternalDictionary is configured
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43330 Bug ID: 43330 Summary: C4::Tags fails to compile when TagsExternalDictionary is configured Initiative type: --- Sponsorship --- status: Product: Koha Version: 25.11 Hardware: All OS: All Status: NEW Severity: major Priority: P5 - low Component: Architecture, internals, and plumbing Assignee: koha-bugs@lists.koha-community.org Reporter: Laura.escamilla@bywatersolutions.com QA Contact: testopia@bugs.koha-community.org Target Milestone: --- When the TagsExternalDictionary system preference contains a value, C4::Tags fails to compile with: Undefined subroutine &C4::Tags::check_install called at C4/Tags.pm line 44. This can cause HTTP 500 errors throughout the staff interface on pages which load C4::Tags, including the staff home page, catalog detail pages, and Tools. Observed on Koha 25.11.06. The problem appears to be caused by the order in which check_install is imported in C4/Tags.pm. Currently C4/Tags.pm contains: use Modern::Perl; use base 'Exporter'; use C4::Context; BEGIN { ... my $ext_dict = C4::Context->preference('TagsExternalDictionary'); if ( $ext_dict && !check_install( module => 'Lingua::Ispell' ) ) { warn "Ignoring TagsExternalDictionary, because Lingua::Ispell is not installed."; $ext_dict = q{}; } ... } but Module::Load::Conditional is loaded later: use Module::Load::Conditional qw( check_install ); Because the check occurs inside a BEGIN block, the BEGIN block is executed during compilation before Perl reaches the later `use Module::Load::Conditional` statement. As a result, when TagsExternalDictionary has a non-empty value, Perl attempts to call check_install() before that function has been imported. When TagsExternalDictionary is empty, the problem is hidden because this expression short-circuits: $ext_dict && !check_install(...) so check_install() is never called. To recreate: 1. Set the TagsExternalDictionary system preference to a non-empty value, for example: /usr/bin/ispell 2. Restart Plack if necessary. 3. Visit a staff interface page which loads C4::Tags, such as the staff home page or a bibliographic detail page. OR reproduce directly from the command line: perl -MC4::Tags -e 'print "C4::Tags loaded OK\n"' 4. Observe: Undefined subroutine &C4::Tags::check_install called at C4/Tags.pm line 44. BEGIN failed--compilation aborted at C4/Tags.pm line 53. Compilation failed in require. BEGIN failed--compilation aborted. 5. Clear TagsExternalDictionary and clear/update the system preference cache. 6. Run the same command again. 7. C4::Tags loads successfully. -- 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=43330 Laura Escamilla <Laura.escamilla@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |Laura.escamilla@bywatersolu |ity.org |tions.com 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=43330 --- Comment #1 from Laura Escamilla <Laura.escamilla@bywatersolutions.com> --- Created attachment 203753 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=203753&action=edit Bug 43330: Fix C4::Tags compile failure with TagsExternalDictionary -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43330 --- Comment #2 from Laura Escamilla <Laura.escamilla@bywatersolutions.com> --- Created attachment 203754 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=203754&action=edit Bug 43330: Add regression test for TagsExternalDictionary To test: 1. Set the TagsExternalDictionary system preference to a non-empty value, for example: /usr/bin/ispell 2. Restart Plack if necessary. 3. Visit a staff interface page which loads C4::Tags, such as the staff home page or a bibliographic detail page. 4. Observe: Undefined subroutine &C4::Tags::check_install called at C4/Tags.pm line 44. BEGIN failed--compilation aborted at C4/Tags.pm line 53. Compilation failed in require. BEGIN failed--compilation aborted. 5. Clear TagsExternalDictionary and clear/update the system preference cache. 6. Apply the patch. 7. Set TagsExternalDictionary to an empty value. 8. Verify that you can access the home page and other pages. 9. Set TagsExternalDictionary to a valid non-empty path such as /usr/bin/ispell 10. Verify the staff home page, catalog detail page, and Tools page load without HTTP 500 errors. 11. Prove t/db_dependent/TagsExternalDictionary.t 12. Sign off and have a great day! :D -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43330 David Nind <david@davidnind.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=43330 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #203753|0 |1 is obsolete| | Attachment #203754|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=43330 --- Comment #3 from David Nind <david@davidnind.com> --- Created attachment 203826 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=203826&action=edit Bug 43330: Fix C4::Tags compile failure with TagsExternalDictionary Signed-off-by: David Nind <david@davidnind.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43330 --- Comment #4 from David Nind <david@davidnind.com> --- Created attachment 203827 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=203827&action=edit Bug 43330: Add regression test for TagsExternalDictionary To test: 1. Set the TagsExternalDictionary system preference to a non-empty value, for example: /usr/bin/ispell 2. Restart Plack if necessary. 3. Visit a staff interface page which loads C4::Tags, such as the staff home page or a bibliographic detail page. 4. Observe: Undefined subroutine &C4::Tags::check_install called at C4/Tags.pm line 44. BEGIN failed--compilation aborted at C4/Tags.pm line 53. Compilation failed in require. BEGIN failed--compilation aborted. 5. Clear TagsExternalDictionary and clear/update the system preference cache. 6. Apply the patch. 7. Set TagsExternalDictionary to an empty value. 8. Verify that you can access the home page and other pages. 9. Set TagsExternalDictionary to a valid non-empty path such as /usr/bin/ispell 10. Verify the staff home page, catalog detail page, and Tools page load without HTTP 500 errors. 11. Prove t/db_dependent/TagsExternalDictionary.t 12. Sign off and have a great day! :D Signed-off-by: David Nind <david@davidnind.com> -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org