itstool: added missing patch
This commit is contained in:
parent
72770b2a45
commit
684431b942
@ -1,6 +1,6 @@
|
||||
untrusted comment: verify with /etc/ports/opt.pub
|
||||
RWSE3ohX2g5d/fWE2euZ5K+L43ur/M5xclGPHSTZ7+4Xce24kWiwHKZ2c6uHZXoUYugQKtk4bcOPrVN/5/9J0dxeJsQvRRJJmwI=
|
||||
SHA256 (Pkgfile) = 7305b3c892782523d5a5be6aa6059ecbef411a90191fd3d4d165f9fda88c142f
|
||||
RWSE3ohX2g5d/Td2aKKmAbQzb/ef1lktFU9A8R/z3OkoBY1BzL2usrRtvS3o1OOyqbUbywiEU61S43dlUeHWPYW6G7uyvQnlwQc=
|
||||
SHA256 (Pkgfile) = fd82d110dbdb3b5149c73fd660200f43048d3e17ccafa7abcd35ce8cdb03e90c
|
||||
SHA256 (.footprint) = c4575ed0855fe330812c99fc5a1cad8647601e5ef70601a67151289b91d16ee6
|
||||
SHA256 (itstool-2.0.7.tar.bz2) = 6b9a7cd29a12bb95598f5750e8763cee78836a1a207f85b74d8b3275b27e87ca
|
||||
SHA256 (0001-Fix-the-crash-from-912099.patch) = b43cea38118aaefa6724136d142dcc7099cd6de04cf2e226f53d4310dfe207cc
|
||||
SHA256 (fix_crash_912099.patch) = cb57e3694ab3d7c62b063629b2e9edc6327260c0797d0f33c8dc97fe37c40ebb
|
||||
|
@ -7,12 +7,12 @@ name=itstool
|
||||
version=2.0.7
|
||||
release=2
|
||||
source=(https://files.itstool.org/itstool/$name-$version.tar.bz2
|
||||
0001-Fix-the-crash-from-912099.patch)
|
||||
fix_crash_912099.patch)
|
||||
|
||||
build() {
|
||||
cd $name-$version
|
||||
|
||||
patch -p1 -i $SRC/0001-Fix-the-crash-from-912099.patch
|
||||
patch -p1 -i $SRC/fix_crash_912099.patch
|
||||
|
||||
PYTHON=/usr/bin/python3 \
|
||||
./configure --prefix=/usr
|
||||
|
68
itstool/fix_crash_912099.patch
Normal file
68
itstool/fix_crash_912099.patch
Normal file
@ -0,0 +1,68 @@
|
||||
Description: Fix the crash from #912099
|
||||
ITS Tool 2.0.4 crashes when building some documentation, as reported in
|
||||
#912099. This comes from translations with invalid XML markup, which ITS Tool
|
||||
fails to merge (which is not abnormal), and to report these issues, needlessly
|
||||
encodes the original msgstr from unicode to bytes, causing it to be recoded
|
||||
using the default ascii codec, which fails when the msgstr contains anything
|
||||
out of ascii.
|
||||
.
|
||||
This patch removes the useless decoding, avoiding the failing subsequent
|
||||
recoding. It also explicitly encodes the output strings to be able to print
|
||||
them in all cases, even when the output encoding cannot be detected.
|
||||
Bug: https://github.com/itstool/itstool/issues/25
|
||||
Bug-Debian: https://bugs.debian.org/912099
|
||||
Forwarded: https://github.com/itstool/itstool/issues/25
|
||||
Author: Tanguy Ortolo <tanguy+debian@ortolo.eu>
|
||||
Last-Update: 2018-12-071
|
||||
|
||||
Index: itstool/itstool.in
|
||||
===================================================================
|
||||
--- itstool.orig/itstool.in 2018-12-10 18:31:23.762143539 +0100
|
||||
+++ itstool/itstool.in 2018-12-10 18:38:03.496777117 +0100
|
||||
@@ -44,9 +44,22 @@
|
||||
else:
|
||||
return str(s)
|
||||
ustr_type = str
|
||||
+ def pr_str(s):
|
||||
+ """Return a string that can be safely print()ed"""
|
||||
+ # Since print works on both bytes and unicode, just return the argument
|
||||
+ return s
|
||||
else:
|
||||
string_types = basestring,
|
||||
ustr = ustr_type = unicode
|
||||
+ def pr_str(s):
|
||||
+ """Return a string that can be safely print()ed"""
|
||||
+ if isinstance(s, str):
|
||||
+ # Since print works on str, just return the argument
|
||||
+ return s
|
||||
+ else:
|
||||
+ # print may not work on unicode if the output encoding cannot be
|
||||
+ # detected, so just encode with UTF-8
|
||||
+ return unicode.encode(s, 'utf-8')
|
||||
|
||||
NS_ITS = 'http://www.w3.org/2005/11/its'
|
||||
NS_ITST = 'http://itstool.org/extensions/'
|
||||
@@ -1060,9 +1073,9 @@
|
||||
if strict:
|
||||
raise
|
||||
else:
|
||||
- sys.stderr.write('Warning: Could not merge %stranslation for msgid:\n%s\n' % (
|
||||
+ sys.stderr.write(pr_str('Warning: Could not merge %stranslation for msgid:\n%s\n' % (
|
||||
(lang + ' ') if lang is not None else '',
|
||||
- msgstr.encode('utf-8')))
|
||||
+ msgstr)))
|
||||
self._xml_err = ''
|
||||
return node
|
||||
def scan_node(node):
|
||||
@@ -1087,9 +1100,9 @@
|
||||
if strict:
|
||||
raise
|
||||
else:
|
||||
- sys.stderr.write('Warning: Could not merge %stranslation for msgid:\n%s\n' % (
|
||||
+ sys.stderr.write(pr_str('Warning: Could not merge %stranslation for msgid:\n%s\n' % (
|
||||
(lang + ' ') if lang is not None else '',
|
||||
- msgstr.encode('utf-8')))
|
||||
+ msgstr)))
|
||||
self._xml_err = ''
|
||||
ctxt.doc().freeDoc()
|
||||
return node
|
Loading…
x
Reference in New Issue
Block a user