[ubuntu-dev] Bug#926633: FutureWarning: Possible nested set at position 1
Witold Baryluk
witold.baryluk at gmail.com
Tue Sep 3 21:17:18 BST 2019
Package: gdebi
Version: 0.9.5.7+nmu3
Followup-For: Bug #926633
Yes, same happens in en_US locale with 'y' answer.
The issue is in the regexp, it should be just:
r'\[(\S+)/\S+\]'
Example:
>>> msg = "Do you want to install the software package? [y/N]:"
>>> import re
>>> print re.findall(r'\[(\S+)/\S+\]', msg)[0].lower()
y
>>>
showing it works correctly.
I have no idea why [(] was used there in the first place, as it is
certainly not correct (but for some reasons work):
I see these commits affecting some changes in the regexp:
https://bazaar.launchpad.net/~gdebi-developers/gdebi/trunk/revision/402 , by Adam Barratt
https://bazaar.launchpad.net/~gdebi-developers/gdebi/trunk/revision/371 , closes bug #629403
My guess, some translations used a form of ".... (y/N):" instead.
If so, then a better and explicit choice is:
r'[\[\(](\S+)/\S+[\]\)]'
Example:
>>> msg = "Do you want to install the software package? [y/N]:"
>>> print re.findall(r'[\[\(](\S+)/\S+[\]\)]', msg)[0].lower()
y
>>> msg = "Do you want to install the software package? (y/N):"
>>> print re.findall(r'[\[\(](\S+)/\S+[\]\)]', msg)[0].lower()
y
>>>
for safety would be a better idea (do not relay on implicit rules inside
character class of treating special characters differently).
In principle the left side, the [[(], is correct and the second [ doesn't
need to be escaped according to traditional regexp rules. However, on the
right side, the [])], simply doesn't make sense, and is wrong. The ']'
character inside class defintion must be escaped, otherwise it closes the
character class (and it becomes empty character class, [], followed by
incorrect closing bracked ), and followed by a litteral implicit
character ]), so it must be [\])]. Maybe some regexp engines assume that
it doesn't make sense to create empty character class, so a next
character (]), is a part of a character class, but that simply is weird
thing to do, assume, and should be regarded as invalid regexp.
Cheers,
Witold
-- System Information:
Debian Release: bullseye/sid
APT prefers unstable
APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386
Kernel: Linux 5.2.0-2-amd64 (SMP w/32 CPU cores)
Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_OOT_MODULE, TAINT_UNSIGNED_MODULE
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
Versions of packages gdebi depends on:
ii gdebi-core 0.9.5.7+nmu3
ii gir1.2-gtk-3.0 3.24.10-1
ii gir1.2-vte-2.91 0.54.2-2
ii gnome-icon-theme 3.12.0-3
ii policykit-1 0.105-26
ii python3 3.7.3-1
ii python3-gi 3.32.2-1
Versions of packages gdebi recommends:
ii libgtk2-perl 2:1.24992-1+b2
ii lintian 2.19.0
ii shared-mime-info 1.10-1
gdebi suggests no packages.
-- no debconf information
More information about the ubuntu-dev-team
mailing list