Bug 37252 - Saving an authority record as MADS (XML) fails
Summary: Saving an authority record as MADS (XML) fails
Status: Passed QA
Alias: None
Product: Koha
Classification: Unclassified
Component: MARC Authority data support (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal (vote)
Assignee: Phil Ringnalda
QA Contact: Pedro Amorim
URL:
Keywords:
Depends on: 37235
Blocks:
  Show dependency treegraph
 
Reported: 2024-07-03 21:18 UTC by Phil Ringnalda
Modified: 2024-07-05 20:10 UTC (History)
2 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
This fixes the saving of authority records in MADS format in the staff interface (Authorities > search results > authority details > Save > MADS (XML)). Before this fix, the downloaded records had a zero file size and were empty.
Version(s) released in:


Attachments
Bug 37252: Use our local copy of MARC21slimUtils.xsl in MARC21slim2MADS.xsl (3.70 KB, patch)
2024-07-03 21:28 UTC, Phil Ringnalda
Details | Diff | Splinter Review
Bug 37252: Use our local copy of MARC21slimUtils.xsl in MARC21slim2MADS.xsl (3.75 KB, patch)
2024-07-04 00:58 UTC, David Nind
Details | Diff | Splinter Review
Bug 37252: Use our local copy of MARC21slimUtils.xsl in MARC21slim2MADS.xsl (3.81 KB, patch)
2024-07-05 15:06 UTC, Pedro Amorim
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Phil Ringnalda 2024-07-03 21:18:01 UTC
Until it has been pushed, you need the patch for bug 37235 to see this, since otherwise you're stopped by a CSRF-related error first.

Steps to reproduce:
1. View details for an authority record, e.g. /cgi-bin/koha/authorities/detail.pl?authid=620
2. tail -f /var/log/koha/kohadev/plack-intranet-error.log
3. In the authority details page, Save - MADS (XML)

Expected result is a downloaded file of more than zero bytes, Actual result is a zero byte file and the following logged errors:

[WARN] XSLT::Base: Unknown IO errorI/O warning : failed to load external entity "http://www.loc.gov/marcxml/xslt/MARC21slimUtils.xsl"
compilation error: file /kohadevbox/koha/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2MADS.xsl element include
xsl:include : unable to load http://www.loc.gov/marcxml/xslt/MARC21slimUtils.xsl
 at /kohadevbox/koha/Koha/XSLT/Base.pm line 346.
[WARN] Use of uninitialized value $marc in print at /kohadevbox/koha/authorities/export.pl line 47.

If you eventually notice that the URL, which seems to work fine in a browser, is actually sending a 301 to http://www.loc.gov/standards/marcxml/xslt/MARC21slimUtils.xsl and you update the include to that, it still fails.

As bug 29556 pointed out, the MADS XSLT is alone in including MARC21slimUtils.xsl from LoC, all our others include our local copy. If we want to have a canary in the coal mine that tells us when that fails, we should make it something which will actually produce a visible failure, not this spectacularly obscure authority format download.
Comment 1 Phil Ringnalda 2024-07-03 21:28:10 UTC
Created attachment 168479 [details] [review]
Bug 37252: Use our local copy of MARC21slimUtils.xsl in MARC21slim2MADS.xsl

Our local copy of the Library of Congress stylesheet MARC21slim2MADS.xsl is
our only one which includes MARC21slimUtils.xsl directly from the Library of
Congress rather than including our local copy. That makes it a fragile canary
for whatever reason that it currently isn't loading, but because it's not
exactly the most popular menu choice in all of Koha, it's far from being one
that anyone will notice.

We should instead include our local copy, make the bug 29556 change to
MARC21slim2MADS.xsl, and if someone wants to notice when including xsl from
LoC fails, they should write a test for it rather than depend on someone
noticing that saving authority records as MADS fails.

Test plan:
1. Without the patch, Authorities - search for Smith - click the linked
   name of any result to show authorities/detail.pl
2. Save - MADS (XML)
3. Check your downloaded file, see that it is zero bytes
4. Apply patch, restart_all
5. Repeat step 2, but this time find that your downloaded file is more
   than zero bytes.
Comment 2 David Nind 2024-07-04 00:58:27 UTC
Created attachment 168485 [details] [review]
Bug 37252: Use our local copy of MARC21slimUtils.xsl in MARC21slim2MADS.xsl

Our local copy of the Library of Congress stylesheet MARC21slim2MADS.xsl is
our only one which includes MARC21slimUtils.xsl directly from the Library of
Congress rather than including our local copy. That makes it a fragile canary
for whatever reason that it currently isn't loading, but because it's not
exactly the most popular menu choice in all of Koha, it's far from being one
that anyone will notice.

We should instead include our local copy, make the bug 29556 change to
MARC21slim2MADS.xsl, and if someone wants to notice when including xsl from
LoC fails, they should write a test for it rather than depend on someone
noticing that saving authority records as MADS fails.

Test plan:
1. Without the patch, Authorities - search for Smith - click the linked
   name of any result to show authorities/detail.pl
2. Save - MADS (XML)
3. Check your downloaded file, see that it is zero bytes
4. Apply patch, restart_all
5. Repeat step 2, but this time find that your downloaded file is more
   than zero bytes.

Signed-off-by: David Nind <david@davidnind.com>
Comment 3 David Nind 2024-07-04 01:01:09 UTC
Testing notes (using KTD):

1. Before working through the test plan, apply bug 37235. Otherwise, you will get a 500 error for steps 2 and 3 of the test plan.
2. When applying the patch, say n (for no) to not apply the dependent patch.
Comment 4 Pedro Amorim 2024-07-05 15:06:22 UTC
Created attachment 168555 [details] [review]
Bug 37252: Use our local copy of MARC21slimUtils.xsl in MARC21slim2MADS.xsl

Our local copy of the Library of Congress stylesheet MARC21slim2MADS.xsl is
our only one which includes MARC21slimUtils.xsl directly from the Library of
Congress rather than including our local copy. That makes it a fragile canary
for whatever reason that it currently isn't loading, but because it's not
exactly the most popular menu choice in all of Koha, it's far from being one
that anyone will notice.

We should instead include our local copy, make the bug 29556 change to
MARC21slim2MADS.xsl, and if someone wants to notice when including xsl from
LoC fails, they should write a test for it rather than depend on someone
noticing that saving authority records as MADS fails.

Test plan:
1. Without the patch, Authorities - search for Smith - click the linked
   name of any result to show authorities/detail.pl
2. Save - MADS (XML)
3. Check your downloaded file, see that it is zero bytes
4. Apply patch, restart_all
5. Repeat step 2, but this time find that your downloaded file is more
   than zero bytes.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>