]> git.ipfire.org Git - thirdparty/systemd.git/commit
hwdb: fix check for uppercasedness of match patterns
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 4 Jan 2022 09:39:53 +0000 (10:39 +0100)
committerBastien Nocera <hadess@hadess.net>
Tue, 4 Jan 2022 10:04:33 +0000 (11:04 +0100)
commit1a37237e2ffe6dfe142224a9d9e8b24135e93244
tree3f25e56349f46d0b478eeaa3347158421dd20cd6
parent1341f25b9b651ce11e9da44751bfb35111bec4ca
hwdb: fix check for uppercasedness of match patterns

The check was added in 77547d5313ea916d2fb64ca5a8812734e9b50f92, but
it doesn't work as expected. Because the second part is wrapped in Optional(),
it would silently "succeed" when the lowercase digits were in the second part:

>>> from parse_hwdb import *
>>> g = 'v' + upperhex_word(4) + Optional('p' + upperhex_word(4))
>>> g.parseString('v04D8pE11C*')
(['v', '04D8', 'p', 'E11C'], {})
>>> g.parseString('v04D8pe11c*')
(['v', '04D8'], {})

The following matches are OK:
usb:v0627p0001:*QEMU USB Keyboard*
usb:v0627p0001:*
usb:v0627p0001*
usb:v0627*
hwdb.d/parse_hwdb.py