** Patch removed: "lp2153146-jc-noble.debdiff"
https://bugs.launchpad.net/ubuntu/+source/jc/+bug/2153146/+attachment/5971838/+files/lp2153146-jc-noble.debdiff
** Description changed:
[ Impact ]
The jc package in Noble (1.25.1-1) shows three syntax warnings when installing
the package via 'apt install' [0]. These warnings occur because Python 3.12,
which ships with Noble, strictly flags invalid backslash escape sequences in
standard string literals, which will become hard syntax errors in future
Python
releases. [1]
The fix resolves the issue by prepending an 'r' to the affected string
literals
in jc/utils.py and jc/parsers/dir.py, turning them into raw strings. This fix
has already been accepted upstream in version 1.25.2 [2].
[ Test Plan ]
The test can be performed in a standard Ubuntu Noble environment using a LXD
container.
** Set Up Testing Environment **
1. Create a Noble LXD container:
$ lxc launch ubuntu:noble jc-test
$ lxc shell jc-test
** Verify the Bug **
2. Install the current version of jc:
$ sudo apt update && sudo apt install -y jc
3. Confirm the warnings:
Setting up jc (1.25.1-1) ...
/usr/lib/python3/dist-packages/jc/parsers/dir.py:1: SyntaxWarning: invalid
escape sequence '\>'
"""jc - JSON Convert `dir` command output parser
/usr/lib/python3/dist-packages/jc/utils.py:213: SyntaxWarning: invalid
escape sequence '\]'
"""
/usr/lib/python3/dist-packages/jc/utils.py:232: SyntaxWarning: invalid
escape sequence '\]'
special = '''!"#$%&'()*+,-./:;<=>?@[\]^`{|}~ '''
** Verify the Fix **
4. Clean up previous installation:
$ sudo apt remove --purge -y jc
5. Enable proposed and install patched jc:
$ sudo apt update && sudo apt install -y jc
6. Confirm the fix:
Verify the terminal output does not contain any SyntaxWarning messages
[ Where Problems Could Occur ]
If a typo was introduced while prepending the raw string indicators (e.g.,
modifying the string boundaries or unintentionally altering characters inside
the string literals), the parser for the dir command or the normalize_key
function could process data incorrectly.
This would show up as failures or malformed JSON output when users attempt to
parse the dir command, or as incorrect key naming when processing fields that
contain special characters like brackets or backslashes.
[ Other Info ]
+ This fix depends on LP: #2153428. The fix for this bug will be bundled with
the
+ fix for LP: #2153428 into a single package upload. The consolidated debdiff
+ will be uploaded and attached to this bug report.
+
Since the syntax warnings were introduced in Python 3.12, Jammy is not
affected
by this bug as it ships with Python 3.10.
Packages in Questing and later releases already have the fix.
[0] - https://github.com/kellyjonbrazil/jc/issues/647
[1] - https://docs.python.org/3/whatsnew/3.12.html#other-language-changes
[2] -
https://github.com/kellyjonbrazil/jc/commit/50638cc11ed0eeb48b3c522102ebc574499c4e97
--
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2153146
Title:
jc Package Produces SyntaxWarning Messages on Installation
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/jc/+bug/2153146/+subscriptions
--
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs