systemd-stub on CentOS has misaligned PE sections causing us to read
a bunch of null bytes from the sdmagic section. Let's treat this case
as not finding a stub version to fix the CI builds.
except KeyError:
return None
- sdmagic_text = sdmagic.read_text()
+ sdmagic_text = sdmagic.read_text().strip("\x00")
+
+ # Older versions of the stub have misaligned sections which results in an empty sdmagic text. Let's check for that
+ # explicitly and treat it as no version.
+ # TODO: Drop this logic once every distribution we support ships systemd-stub v254 or newer.
+ if not sdmagic_text:
+ return None
+
if not (version := re.match(r"#### LoaderInfo: systemd-stub (?P<version>[.~^a-zA-Z0-9-+]+) ####", sdmagic_text)):
die(f"Unable to determine systemd-stub version, found {sdmagic_text!r}")