https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=35332
--- Comment #8 from Paul Derscheid <[email protected]> --- Created attachment 211614 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=211614&action=edit Bug 35332: Terminate the last POT header line in xgettext-tt2 Locale::XGettext joins the header fields with "\n" but does not terminate the last one, so xgettext-tt2 writes "Content-Transfer-Encoding: 8bit" instead of "Content-Transfer-Encoding: 8bit\n" pofile (used by gulp-concat-po) then parses the value as '8bit"' and writes a corrupted header, making msgmerge fail when the TT2 stream is the first to reach gulp-concat-po. The previous patch avoids the corruption by forcing Content-Transfer-Encoding in gulpfile.js. That works, but it fixes the symptom in the consumer rather than the malformed output of the producer: - It only works because the broken field happens to be one we can force. If Locale::XGettext adds or reorders header fields, whichever field ends up last gets corrupted and the random failure is back. - GNU xgettext terminates every header line with \n. xgettext-tt2 should produce the same output so that every tool reading it, not only gulp-concat-po with the right forced headers, gets a clean header. Fix the header at its source by overriding __poHeader in xgettext-tt2, and remove the Content-Transfer-Encoding workaround from gulpfile.js. Test plan: The failure only happens when xgettext-tt2 finishes before GNU xgettext. In KTD GNU xgettext is much faster (~0.5s vs ~3s), so the TT2 stream almost never wins. Slow GNU xgettext down by a random delay to trigger the race (/tmp is mounted noexec in KTD, use another dir): mkdir -p /opt/slow printf '#!/bin/bash\nsleep $((RANDOM %% 6))\nexec /usr/bin/xgettext "$@"\n' > /opt/slow/xgettext chmod +x /opt/slow/xgettext 1. Without the patches from this bug, run: for i in $(seq 1 20); do PATH=/opt/slow:$PATH gulp po:extract --task messages >/dev/null 2>&1 msgcat misc/translator/Koha-messages.pot -o /dev/null || { grep Content-Transfer misc/translator/Koha-messages.pot; break; } done 2. After a few iterations msgcat fails with: syntax error / keyword "n" unknown and the header line is: "Content-Transfer-Encoding: 8bit"\n" gulp po:update --lang de-DE then fails with the same msgmerge errors 3. Apply the patches and repeat 1 4. All the iterations pass, the header line is always "Content-Transfer-Encoding: 8bit\n" and gulp po:update --lang de-DE completes without msgmerge errors Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Jonathan Druart <[email protected]> Signed-off-by: Paul Derscheid <[email protected]> -- You are receiving this mail because: You are watching all bug changes. _______________________________________________ Koha-bugs mailing list -- [email protected] To unsubscribe send an email to [email protected] website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
