Bugzilla – Attachment 145639 Details for
Bug 31259
Downloading patron card PDF hangs the server
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 31259: Escape infinite loop when lime cannot wrap enough
Bug-31259-Escape-infinite-loop-when-lime-cannot-wr.patch (text/plain), 2.38 KB, created by
David Nind
on 2023-01-24 22:16:15 UTC
(
hide
)
Description:
Bug 31259: Escape infinite loop when lime cannot wrap enough
Filename:
MIME Type:
Creator:
David Nind
Created:
2023-01-24 22:16:15 UTC
Size:
2.38 KB
patch
obsolete
>From 10f14c366251b3843ddf2bb27bf6535ca9d72971 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Mon, 23 Jan 2023 12:51:48 +0000 >Subject: [PATCH] Bug 31259: Escape infinite loop when lime cannot wrap enough > >It seems the wrapping here works with words, not characters. If a line is too long, >or too far over, we can't trim it enough. We need to escape if successive loops are >not changing the line > >To test: > 1 - Using sample data, edit the layout to match picture in comment 9 > 2 - Add some borrowers to a batch > 3 - Attempt to export batch and save PDF > 4 - Staff client waits > 5 - ps aux | grep card > 6 - Note the job keeps running > 7 - Kill it > 8 - Apply patch > 9 - Restart_all >10 - Export batch again >11 - Success, you get a badly formatted PDF, rather than nothing >12 - Note the PDF does not show "Yakama Nation Library" >13 - Edit layout, male "Lower left X" 20 instead of 220 >14 - Export again and note text field 1 shows correctly > >Signed-off-by: David Nind <david@davidnind.com> >--- > C4/Patroncards/Patroncard.pm | 7 +++++++ > 1 file changed, 7 insertions(+) > >diff --git a/C4/Patroncards/Patroncard.pm b/C4/Patroncards/Patroncard.pm >index ea1d077727..9a8901ae0e 100644 >--- a/C4/Patroncards/Patroncard.pm >+++ b/C4/Patroncards/Patroncard.pm >@@ -260,6 +260,7 @@ sub draw_text { > # my $string_width = ($font_units_width * $text_attribs->{'font_size'}) / $units_per_em; > my $string_width = C4::Creators::PDF->StrWidth($line, $text_attribs->{'font'}, $text_attribs->{'font_size'}); > if (($string_width + $text_attribs->{'llx'}) > $self->{'width'}) { >+ my $cur_line = ""; > WRAP_LINES: > while (1) { > # $line =~ m/^.*(\s\b.*\b\s*|\s&|\<\b.*\b\>)$/; # original regexp... can be removed after dev stage is over >@@ -287,6 +288,12 @@ sub draw_text { > push @lines, {line=> $line, Tx => $Tx, Ty => $Ty, Tw => $Tw}; > last WRAP_LINES; > } >+ } else { >+ # We only split lines on spaces - it seems if we push a line too far, it can end >+ # never getting short enough in which case we need to escape and the malformed PDF >+ # will indicate the layout problem >+ last WRAP_LINES if $cur_line eq $line; >+ $cur_line = $line; > } > } > } >-- >2.30.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 31259
:
138917
|
145571
|
145639
|
148224