[Bug 39295] New: Patron card creator infinite loop during template/layout incompatibility
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39295 Bug ID: 39295 Summary: Patron card creator infinite loop during template/layout incompatibility Change sponsored?: --- Product: Koha Version: Main Hardware: All OS: All Status: NEW Severity: critical Priority: P5 - low Component: Tools Assignee: koha-bugs@lists.koha-community.org Reporter: dcook@prosentient.com.au QA Contact: testopia@bugs.koha-community.org To reproduce: 0. Change Koha test user's firstnameto "Firstname" and surname to "Lastname" 1. Create a template: Units: PostScript Points Page height: 60pt Page width: 60pt Card height: 60pt Card with: 60pt Top page margin: 10pt Left page margin: 10pt Number of columns: 1 Number of rows: 1 Gap between columns: 10pt Gap between rows: 10pt 2. Create a layout: Units: US inches Field 1: Text: Library Name Font: Times-Roman Font size: 12 pt Text alignment: Left Lower left X coordinate: 100in Lower left Y coordinate: 100in Field 2: Text: <firstname> <surname> Font: Times-Roman Font size: 10pt Text alignment: Left Lower left X coordinate: 5in Lower left Y coordinate: 5in 3. Create a batch for borrowernumber 51 (if using "koha" test user in ktd) 4. Export using the above template and layout 5. Note that an infinite loop is triggered If you use strace, the syscalls produced during the loop will look like this: [pid 935276] newfstatat(AT_FDCWD, "/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf", {st_mode=S_IFREG|0644, st_size=705684, ...}, 0) = 0 [pid 935276] newfstatat(AT_FDCWD, "/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf", {st_mode=S_IFREG|0644, st_size=705684, ...}, 0) = 0 [pid 935276] newfstatat(AT_FDCWD, "/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf", {st_mode=S_IFREG|0644, st_size=705684, ...}, 0) = 0 -- 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=39295 David Cook <dcook@prosentient.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|Patron card creator |Patron card creator |infinite loop during |infinite loop during line |template/layout |wrapping in template/layout |incompatibility |incompatibility -- 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=39295 David Cook <dcook@prosentient.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |dcook@prosentient.com.au |ity.org | --- Comment #1 from David Cook <dcook@prosentient.com.au> --- The patron creator code is problematic in a lot of ways, and I haven't worked out the exact interplay between template and layout that causes this problem. All I know is that the infinite loop happens because in the WRAP_LINES loop the $line can be set to "" which causes $string_width to be set to 0, which creates an infinite loop as it tries to wrap a string which doesn't exist to create a label which is impossible. -- 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=39295 David Cook <dcook@prosentient.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- 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=39295 --- Comment #2 from David Cook <dcook@prosentient.com.au> --- Created attachment 179133 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=179133&action=edit Bug 39295: Prevent infinite loop on line wrapping This change checks that the string width is larger than 0 before attempting to perform line wrapping on the line. Test plan: 0. Apply the patch and koha-plack --restart kohadev 1. Follow instructions at end of this message[1] 2. Note that the infinite loop does not happen and that a blank card is created 3. Export the batch using the test layout and template that come with koha-testing-docker 4. Note that the patron card is correctly created [1] To reproduce: 0. Change Koha test user's firstnameto "Firstname" and surname to "Lastname" 1. Create a template: Units: PostScript Points Page height: 60pt Page width: 60pt Card height: 60pt Card with: 60pt Top page margin: 10pt Left page margin: 10pt Number of columns: 1 Number of rows: 1 Gap between columns: 10pt Gap between rows: 10pt 2. Create a layout: Units: US inches Field 1: Text: Library Name Font: Times-Roman Font size: 12 pt Text alignment: Left Lower left X coordinate: 100in Lower left Y coordinate: 100in Field 2: Text: <firstname> <surname> Font: Times-Roman Font size: 10pt Text alignment: Left Lower left X coordinate: 5in Lower left Y coordinate: 5in 3. Create a batch for borrowernumber 51 (if using "koha" test user in ktd) 4. Export using the above template and layout -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39295 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=39295 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #179133|0 |1 is obsolete| | --- Comment #3 from David Nind <david@davidnind.com> --- Created attachment 179141 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=179141&action=edit Bug 39295: Prevent infinite loop on line wrapping This change checks that the string width is larger than 0 before attempting to perform line wrapping on the line. Test plan: 0. Apply the patch and koha-plack --restart kohadev 1. Follow instructions at end of this message[1] 2. Note that the infinite loop does not happen and that a blank card is created 3. Export the batch using the test layout and template that come with koha-testing-docker 4. Note that the patron card is correctly created [1] To reproduce: 0. Change Koha test user's firstnameto "Firstname" and surname to "Lastname" 1. Create a template: Units: PostScript Points Page height: 60pt Page width: 60pt Card height: 60pt Card with: 60pt Top page margin: 10pt Left page margin: 10pt Number of columns: 1 Number of rows: 1 Gap between columns: 10pt Gap between rows: 10pt 2. Create a layout: Units: US inches Field 1: Text: Library Name Font: Times-Roman Font size: 12 pt Text alignment: Left Lower left X coordinate: 100in Lower left Y coordinate: 100in Field 2: Text: <firstname> <surname> Font: Times-Roman Font size: 10pt Text alignment: Left Lower left X coordinate: 5in Lower left Y coordinate: 5in 3. Create a batch for borrowernumber 51 (if using "koha" test user in ktd) 4. Export using the above template and layout 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=39295 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |m.de.rooy@rijksmuseum.nl --- Comment #4 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- while (1) { Nothing beats this kind of constructs ;) -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39295 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Patch complexity|--- |Trivial patch 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=39295 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #179141|0 |1 is obsolete| | --- Comment #5 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Created attachment 179322 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=179322&action=edit Bug 39295: Prevent infinite loop on line wrapping This change checks that the string width is larger than 0 before attempting to perform line wrapping on the line. Test plan: 0. Apply the patch and koha-plack --restart kohadev 1. Follow instructions at end of this message[1] 2. Note that the infinite loop does not happen and that a blank card is created 3. Export the batch using the test layout and template that come with koha-testing-docker 4. Note that the patron card is correctly created [1] To reproduce: 0. Change Koha test user's firstnameto "Firstname" and surname to "Lastname" 1. Create a template: Units: PostScript Points Page height: 60pt Page width: 60pt Card height: 60pt Card with: 60pt Top page margin: 10pt Left page margin: 10pt Number of columns: 1 Number of rows: 1 Gap between columns: 10pt Gap between rows: 10pt 2. Create a layout: Units: US inches Field 1: Text: Library Name Font: Times-Roman Font size: 12 pt Text alignment: Left Lower left X coordinate: 100in Lower left Y coordinate: 100in Field 2: Text: <firstname> <surname> Font: Times-Roman Font size: 10pt Text alignment: Left Lower left X coordinate: 5in Lower left Y coordinate: 5in 3. Create a batch for borrowernumber 51 (if using "koha" test user in ktd) 4. Export using the above template and layout Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39295 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- QA Contact|testopia@bugs.koha-communit |m.de.rooy@rijksmuseum.nl |y.org | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39295 --- Comment #6 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Should it be critical? Perhaps major would be enough ;) -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39295 --- Comment #7 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- This code is horrible. This is kind of a trust signoff :) -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39295 --- Comment #8 from David Cook <dcook@prosentient.com.au> --- (In reply to Marcel de Rooy from comment #4)
while (1) {
Nothing beats this kind of constructs ;)
I'm glad that someone else feels my pain haha. (In reply to Marcel de Rooy from comment #6)
Should it be critical? Perhaps major would be enough ;)
I wondered about this as well. I marked it as critical because it has the ability to make a Koha instance unusable with a couple of clicks. I think a person could argue "major" since hopefully most people won't create the necessary conditions to trigger it, but it's really bad when it is triggered. 100% CPU for the Starman worker processes and no responsiveness for the user. (In reply to Marcel de Rooy from comment #7)
This code is horrible. This is kind of a trust signoff :)
Merci :). This code is horrible. Sometimes, I wonder what it'll take for us to replace it. It limps along as "good enough" I think... -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39295 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |Pushed to main Version(s)| |25.05.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=39295 --- Comment #9 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- Pushed for 25.05! Well done everyone, thank you! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39295 Fridolin Somers <fridolin.somers@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to main |Pushed to stable Version(s)|25.05.00 |25.05.00,24.11.06 released in| | CC| |fridolin.somers@biblibre.co | |m --- Comment #10 from Fridolin Somers <fridolin.somers@biblibre.com> --- Pushed to 24.11.x for 24.11.06 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39295 Jesse Maseto <jesse@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jesse@bywatersolutions.com Status|Pushed to stable |Pushed to oldstable --- Comment #11 from Jesse Maseto <jesse@bywatersolutions.com> --- Pushed to 24.05.x for 24.05.12 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39295 Wainui Witika-Park <wainuiwitikapark@catalyst.net.nz> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |wainuiwitikapark@catalyst.n | |et.nz --- Comment #12 from Wainui Witika-Park <wainuiwitikapark@catalyst.net.nz> --- Not backporting to 22.11.x -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39295 Wainui Witika-Park <wainuiwitikapark@catalyst.net.nz> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to oldstable |Needs documenting -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39295 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs documenting |RESOLVED CC| |david@davidnind.com Resolution|--- |FIXED --- Comment #13 from David Nind <david@davidnind.com> --- Bug fix, no changes to the manual required. -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org