Bug 2239326

Summary: Regex processing with python 3.12 fails
Product: [Fedora] Fedora Reporter: Guido Aulisi <guido.aulisi>
Component: itstoolAssignee: Nils Philippsen <nphilipp>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: rawhideCC: gnome-sig, mclasen, nphilipp
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: itstool-2.0.7-6.fc39 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-11-03 18:33:35 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 2225708    

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.