Bug 2239326 - Regex processing with python 3.12 fails
Summary: Regex processing with python 3.12 fails
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: itstool
Version: rawhide
Hardware: Unspecified
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Nils Philippsen
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: 2225708
TreeView+ depends on / blocked
 
Reported: 2023-09-17 14:17 UTC by Guido Aulisi
Modified: 2023-11-03 18:33 UTC (History)
3 users (show)

Fixed In Version: itstool-2.0.7-6.fc39
Clone Of:
Environment:
Last Closed: 2023-11-03 18:33:35 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Guido Aulisi 2023-09-17 14:17:19 UTC
Python 3.12 is more strict with string escaping, \ is interpreted as a unicode char escaping, so many regex fail.

Reproducible: Always

Steps to Reproduce:
1. Install F40
2. Run itstool
3.
Actual Results:  
/usr/bin/itstool:236: SyntaxWarning: invalid escape sequence '\s'
  if re.sub('\s+', ' ', text).strip() != '':
/usr/bin/itstool:334: SyntaxWarning: invalid escape sequence '\s'
  message = re.sub('\s+', ' ', message).strip()
/usr/bin/itstool:472: SyntaxWarning: invalid escape sequence '\s'
  return re.sub('\s+', ' ', self.locnote).strip()
/usr/bin/itstool:474: SyntaxWarning: invalid escape sequence '\s'
  return '(itstool) link: ' + re.sub('\s+', ' ', self.locnoteref).strip()
/usr/bin/itstool:905: SyntaxWarning: invalid escape sequence '\<'
  regex = re.compile('(.*) \<(.*)\>, (.*)')
/usr/bin/itstool:940: SyntaxWarning: invalid escape sequence '\s'
  if re.sub('\s+', '', prevtext) == '':
/usr/bin/itstool:1484: SyntaxWarning: invalid escape sequence '\.'
  _locale_pattern = re.compile('([a-zA-Z0-9-]+)(_[A-Za-z0-9]+)?(@[A-Za-z0-9]+)?(\.[A-Za-z0-9]+)?')
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2023-09-17 16:13+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"


Expected Results:  
No errors

Actually some packages like ardour 7 cannot verify itdtool version when building, so they fail

Comment 1 Guido Aulisi 2023-09-17 14:19:21 UTC
A PR is available from upstream: https://github.com/itstool/itstool/pull/50

Comment 2 Nils Philippsen 2023-10-09 12:44:46 UTC
The upstream PR has been closed because the submitter apparently deleted their fork, so I submitted my own. I've built a fixed package with it.

Comment 3 Fedora Update System 2023-10-09 12:45:19 UTC
FEDORA-2023-fcd1923b88 has been submitted as an update to Fedora 39. https://bodhi.fedoraproject.org/updates/FEDORA-2023-fcd1923b88

Comment 4 Fedora Update System 2023-10-10 01:48:56 UTC
FEDORA-2023-fcd1923b88 has been pushed to the Fedora 39 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2023-fcd1923b88`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2023-fcd1923b88

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 5 Fedora Update System 2023-11-03 18:33:35 UTC
FEDORA-2023-fcd1923b88 has been pushed to the Fedora 39 stable repository.
If problem still persists, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.