]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
string-util: reorder characters in version charset
authorLennart Poettering <lennart@amutable.com>
Tue, 14 Jul 2026 12:44:01 +0000 (14:44 +0200)
committerLennart Poettering <lennart@amutable.com>
Tue, 14 Jul 2026 20:32:27 +0000 (22:32 +0200)
Let's bring the version string character set into a systematic order,
matching the order in which they appear and are defined in the UAPI.10
specification text.

This makes it easier to compare the relevant functions.

src/basic/string-util.c

index 3d3114612c36564bdd1cd2c66d5c04c01d51578f..a806d2ddfa3f741d4a231a362f8bfa9046969268 100644 (file)
@@ -1470,17 +1470,18 @@ bool version_is_valid(const char *s) {
                 return false;
 
         /* This is a superset of the characters used by semver. We additionally allow "_". */
-        if (!in_charset(s, ALPHANUMERICAL "._-+"))
+        if (!in_charset(s, ALPHANUMERICAL ".-+_"))
                 return false;
 
         return true;
 }
 
 bool version_is_valid_versionspec(const char *s) {
+
         if (!filename_part_is_valid(s))
                 return false;
 
-        if (!in_charset(s, ALPHANUMERICAL "-.~^"))
+        if (!in_charset(s, ALPHANUMERICAL ".-~^"))
                 return false;
 
         return true;