os: let vpnprintf() accept %X

Several pieces of the code, as well as drivers are using %X, which
we don't support, so leading to error messages like this:

[2025-02-27 14:28:44] BUG: 'if (f[f_idx])'
[2025-02-27 14:28:44] BUG: ../xserver/os/log.c:538 in vpnprintf()
[2025-02-27 14:28:44] Unsupported printf directive 'X'
[2025-02-27 14:28:44]
[2025-02-27 14:28:44] Backtrace:
[2025-02-27 14:28:44] unw_get_proc_name failed: no unwind info found [-10]
[2025-02-27 14:28:44] 0: /usr/lib/Xorg (?+0x0) [0x5f4d1261bc47]
[2025-02-27 14:28:44] 1: /usr/lib/Xorg (LogVHdrMessageVerb+0x10f) [0x5f4d1261ca3f]
[2025-02-27 14:28:44] 2: /usr/lib/Xorg (LogHdrMessageVerb+0x85) [0x5f4d1261cae5]
[2025-02-27 14:28:44] 3: /usr/lib/Xorg (xf86VDrvMsgVerb+0x54) [0x5f4d12636604]
[2025-02-27 14:28:44] 4: /usr/lib/Xorg (xf86DrvMsg+0x97) [0x5f4d126367d7]
[2025-02-27 14:28:44] 5: /usr/lib/Xorg (xf86PrintEDID+0x545) [0x5f4d12654315]
[2025-02-27 14:28:44] 6: /usr/lib/Xorg (xf86OutputSetEDID+0x1bd) [0x5f4d12657e0d]

In the longer run, we'll have to decide whether we actually want to
implement the upper-case directive or change all callers to lower-case.

But for now it's better to just accept %X and interpret it as lower-case,
in order to fix those error messages. Whether it's printed as upper or
lower case is more or less an aesthetic matter.

Reported-By: guido iodice <guido.iodice@gmail.com>
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1846>
This commit is contained in:
Enrico Weigelt, metux IT consult 2025-02-28 12:46:41 +01:00
parent 53876f1ef1
commit 628e94b164

View File

@ -499,6 +499,7 @@ vpnprintf(char *string, int size_in, const char *f, va_list args)
break; break;
case 'x': case 'x':
case 'X': // not actually upper case, but at least accepting '%X'
if (length_modifier & LMOD_LONGLONG) if (length_modifier & LMOD_LONGLONG)
ui = va_arg(args, unsigned long long); ui = va_arg(args, unsigned long long);
else if (length_modifier & LMOD_LONG) else if (length_modifier & LMOD_LONG)