[Bug 40675] New: Carriage return in patron note message breaks SIP
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40675 Bug ID: 40675 Summary: Carriage return in patron note message breaks SIP Change sponsored?: --- Product: Koha Version: Main Hardware: All OS: All Status: NEW Severity: minor Priority: P5 - low Component: Self checkout Assignee: koha-bugs@lists.koha-community.org Reporter: bernard.scaife@openfifth.co.uk QA Contact: testopia@bugs.koha-community.org If an OPAC message is pasted into a Koha patron's record which includes a carriage return, it breaks the line and SIP. A user at the Kiosk may find they can no longer log in to the SIP kiosk. The SIP2 specification uses the carriage return as the message terminator. -- 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=40675 --- Comment #1 from Bernard <bernard.scaife@openfifth.co.uk> --- Created attachment 185583 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=185583&action=edit Bug 40675 Removes carriage returns from messages to prevent breaking SIP Test 1. Find a user and click "Add message". 2. Choose "Add message for OPAC ... " from dropdown 3. In Word (or similar, type a message adding a carriage return in the middle of it. 4. Copy / paste this text into the message box and save. 5. Run the SIP emulator tool sip_cli_emulator.pl and observe that after the carriage return, the message has broken onto a new line. 6. Install patch 7. restart_all 8. Repeat above 1-5 9. Observe that runaway line is now joined to the previous line (correctly) -- 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=40675 Bernard <bernard.scaife@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- 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=40675 Andrew Fuerste-Henry <andrew@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- 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=40675 Andrew Fuerste-Henry <andrew@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #185583|0 |1 is obsolete| | --- Comment #2 from Andrew Fuerste-Henry <andrew@bywatersolutions.com> --- Created attachment 185791 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=185791&action=edit Bug 40675 Removes carriage returns from messages to prevent breaking SIP Test 1. Find a user and click "Add message". 2. Choose "Add message for OPAC ... " from dropdown 3. In Word (or similar, type a message adding a carriage return in the middle of it. 4. Copy / paste this text into the message box and save. 5. Run the SIP emulator tool sip_cli_emulator.pl and observe that after the carriage return, the message has broken onto a new line. 6. Install patch 7. restart_all 8. Repeat above 1-5 9. Observe that runaway line is now joined to the previous line (correctly) Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com> -- 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=40675 Bernard <bernard.scaife@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #185791|0 |1 is obsolete| | --- Comment #3 from Bernard <bernard.scaife@openfifth.co.uk> --- Created attachment 185792 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=185792&action=edit Bug 40675 Removes carriage returns from messages to prevent breaking SIP - new regex to prevent regression. I am told my original patch could cause a regression and should instead be $value =~ s/\r\n|\r|\n/ /g; "We probably really want to normalise all options to a space as opposed to switching options. My original change switches us from Mac CR characters to Windows combination of CRLF (and unit tends to just stick to LF in the olden days).. so to really fix the bug we should look for all three as above." Test 1. Find a user and click "Add message". 2. Choose "Add message for OPAC ... " from dropdown 3. In Word (or similar, type a message adding a carriage return in the middle of it. 4. Copy / paste this text into the message box and save. 5. Run the SIP emulator tool sip_cli_emulator.pl and observe that after the carriage return, the message has broken onto a new line. 6. Install patch 7. restart_all 8. Repeat above 1-5 9. Observe that runaway line is now joined to the previous line (correctly) -- 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=40675 Bernard <bernard.scaife@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #185792|0 |1 is obsolete| | --- Comment #4 from Bernard <bernard.scaife@openfifth.co.uk> --- Created attachment 185793 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=185793&action=edit Bug 40675 Removes carriage returns from messages to prevent breaking SIP Test 1. Find a user and click "Add message". 2. Choose "Add message for OPAC ... " from dropdown 3. In Word (or similar, type a message adding a carriage return in the middle of it. 4. Copy / paste this text into the message box and save. 5. Run the SIP emulator tool sip_cli_emulator.pl and observe that after the carriage return, the message has broken onto a new line. 6. Install patch 7. restart_all 8. Repeat above 1-5 9. Observe that runaway line is now joined to the previous line (correctly) -- 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=40675 Bernard <bernard.scaife@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #185793|0 |1 is obsolete| | --- Comment #5 from Bernard <bernard.scaife@openfifth.co.uk> --- Created attachment 185794 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=185794&action=edit Bug 40675 Removes carriage returns from messages to prevent breaking SIP - new regex to prevent regression. I am told my original patch could cause a regression and should instead be $value =~ s/\r\n|\r|\n/ /g; "We probably really want to normalise all options to a space as opposed to switching options. My original change switches us from Mac CR characters to Windows combination of CRLF (and unit tends to just stick to LF in the olden days).. so to really fix the bug we should look for all three as above." Test 1. Find a user and click "Add message". 2. Choose "Add message for OPAC ... " from dropdown 3. In Word (or similar, type a message adding a carriage return in the middle of it. 4. Copy / paste this text into the message box and save. 5. Run the SIP emulator tool sip_cli_emulator.pl and observe that after the carriage return, the message has broken onto a new line. 6. Install patch 7. restart_all 8. Repeat above 1-5 9. Observe that runaway line is now joined to the previous line (correctly) -- 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=40675 --- Comment #6 from Bernard <bernard.scaife@openfifth.co.uk> --- Created attachment 185802 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=185802&action=edit Bug 40675: Added new regex to prevent regression I am told my original patch could cause a regression and should instead be $value =~ s/\r\n|\r|\n/ /g; "We probably really want to normalise all options to a space as opposed to switching options. My original change switches us from Mac CR characters to Windows combination of CRLF (and unit tends to just stick to LF in the olden days).. so to really fix the bug we should look for all three as above." -- 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=40675 David Cook <dcook@prosentient.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |dcook@prosentient.com.au -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40675 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |martin.renvoize@openfifth.c | |o.uk Assignee|koha-bugs@lists.koha-commun |bernard.scaife@openfifth.co |ity.org |.uk -- 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=40675 --- Comment #7 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 185833 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=185833&action=edit Bug 40675: Fix SIP message corruption from embedded line endings Patron messages containing carriage returns, line feeds, or CRLF combinations can break SIP protocol communication since CR is used as the SIP message terminator. This causes message parsing failures and protocol errors in self-check systems. The previous regex only handled single carriage returns (\r), missing Windows CRLF (\r\n) and Unix LF (\n) sequences. This patch normalizes all line ending variations to spaces to prevent SIP message corruption while preserving message content. Test plan: 1. Go to a patron record and click "Add message" 2. Select "Add message for OPAC..." from dropdown 3. In a text editor (e.g., Word), create a message with line breaks: "This is line one[Enter]This is line two[Enter]This is line three" 4. Copy and paste this multi-line text into the message box and save 5. Run the SIP emulator: misc/sip_cli_emulator.pl 6. Execute a patron information request for this patron 7. Before patch: Observe message breaks at line endings, corrupting the SIP response 8. Apply patch and restart SIP server 9. Repeat steps 5-6 10. After patch: Verify the message appears as single line with spaces replacing line breaks: "This is line one This is line two This is line three" 11. Test with different line ending types (Windows, Mac, Unix) to ensure all variations are handled correctly Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40675 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #185802|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=40675 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #185794|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=40675 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |kyle@bywatersolutions.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40675 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- QA Contact|testopia@bugs.koha-communit |kyle@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=40675 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Failed QA CC| |m.de.rooy@rijksmuseum.nl --- Comment #8 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Please add a test for a module change :) -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40675 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #185833|0 |1 is obsolete| | --- Comment #9 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 186456 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=186456&action=edit Bug 40675: Fix SIP message corruption from embedded line endings Patron messages containing carriage returns, line feeds, or CRLF combinations can break SIP protocol communication since CR is used as the SIP message terminator. This causes message parsing failures and protocol errors in self-check systems. The previous regex only handled single carriage returns (\r), missing Windows CRLF (\r\n) and Unix LF (\n) sequences. This patch normalizes all line ending variations to spaces to prevent SIP message corruption while preserving message content. Test plan: 1. Go to a patron record and click "Add message" 2. Select "Add message for OPAC..." from dropdown 3. In a text editor (e.g., Word), create a message with line breaks: "This is line one[Enter]This is line two[Enter]This is line three" 4. Copy and paste this multi-line text into the message box and save 5. Run the SIP emulator: misc/sip_cli_emulator.pl 6. Execute a patron information request for this patron 7. Before patch: Observe message breaks at line endings, corrupting the SIP response 8. Apply patch and restart SIP server 9. Repeat steps 5-6 10. After patch: Verify the message appears as single line with spaces replacing line breaks: "This is line one This is line two This is line three" 11. Test with different line ending types (Windows, Mac, Unix) to ensure all variations are handled correctly Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40675 --- Comment #10 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 186457 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=186457&action=edit Bug 40675: Add unit tests for SIP line ending normalization This patch adds comprehensive unit tests for the add_field function to verify that all types of line endings (Unix \n, Windows \r\n, Mac \r, and mixed) are properly normalized to spaces to prevent SIP message corruption. Tests cover: - Unix line endings (\n) - Windows line endings (\r\n) - Mac line endings (\r) - Mixed line ending combinations - Normal text without line endings - Empty values -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40675 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Failed QA |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40675 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- QA Contact|kyle@bywatersolutions.com |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=40675 --- Comment #11 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Looking here -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40675 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA Patch complexity|--- |Trivial patch -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40675 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #186456|0 |1 is obsolete| | --- Comment #12 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Created attachment 186608 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=186608&action=edit Bug 40675: Fix SIP message corruption from embedded line endings Patron messages containing carriage returns, line feeds, or CRLF combinations can break SIP protocol communication since CR is used as the SIP message terminator. This causes message parsing failures and protocol errors in self-check systems. The previous regex only handled single carriage returns (\r), missing Windows CRLF (\r\n) and Unix LF (\n) sequences. This patch normalizes all line ending variations to spaces to prevent SIP message corruption while preserving message content. Test plan: 1. Go to a patron record and click "Add message" 2. Select "Add message for OPAC..." from dropdown 3. In a text editor (e.g., Word), create a message with line breaks: "This is line one[Enter]This is line two[Enter]This is line three" 4. Copy and paste this multi-line text into the message box and save 5. Run the SIP emulator: misc/sip_cli_emulator.pl 6. Execute a patron information request for this patron 7. Before patch: Observe message breaks at line endings, corrupting the SIP response 8. Apply patch and restart SIP server 9. Repeat steps 5-6 10. After patch: Verify the message appears as single line with spaces replacing line breaks: "This is line one This is line two This is line three" 11. Test with different line ending types (Windows, Mac, Unix) to ensure all variations are handled correctly Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> [EDIT] Adjusted the comment in Sip.pm -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40675 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #186457|0 |1 is obsolete| | --- Comment #13 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Created attachment 186609 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=186609&action=edit Bug 40675: Add unit tests for SIP line ending normalization This patch adds comprehensive unit tests for the add_field function to verify that all types of line endings (Unix \n, Windows \r\n, Mac \r, and mixed) are properly normalized to spaces to prevent SIP message corruption. Tests cover: - Unix line endings (\n) - Windows line endings (\r\n) - Mac line endings (\r) - Mixed line ending combinations - Normal text without line endings - Empty values -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40675 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Component|Self checkout |SIP2 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40675 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #186609|0 |1 is obsolete| | --- Comment #14 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Created attachment 186610 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=186610&action=edit Bug 40675: Add unit tests for SIP line ending normalization This patch adds comprehensive unit tests for the add_field function to verify that all types of line endings (Unix \n, Windows \r\n, Mac \r, and mixed) are properly normalized to spaces to prevent SIP message corruption. Tests cover: - Unix line endings (\n) - Windows line endings (\r\n) - Mac line endings (\r) - Mixed line ending combinations - Normal text without line endings - Empty values 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=40675 Lucas Gass (lukeg) <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Version(s)| |25.11.00 released in| | Status|Passed QA |Pushed to main -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40675 --- Comment #15 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- Nice work everyone! Pushed to main for 25.11 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40675 Paul Derscheid <paul.derscheid@lmscloud.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Version(s)|25.11.00 |25.11.00,25.05.04 released in| | Status|Pushed to main |Pushed to stable -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40675 --- Comment #16 from Paul Derscheid <paul.derscheid@lmscloud.de> --- Nice work everyone! Pushed to 25.05.x -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40675 Fridolin Somers <fridolin.somers@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Version(s)|25.11.00,25.05.04 |25.11.00,25.05.04,24.11.10 released in| | Status|Pushed to stable |Pushed to oldstable CC| |fridolin.somers@biblibre.co | |m --- Comment #17 from Fridolin Somers <fridolin.somers@biblibre.com> --- Pushed to 24.11.x for 24.11.10 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40675 Wainui Witika-Park <wainuiwitikapark@catalyst.net.nz> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to oldstable |Needs documenting --- Comment #18 from Wainui Witika-Park <wainuiwitikapark@catalyst.net.nz> --- Not backporting to 22.11.x as it wasn't backported to 24.05.x -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org