[PATCH] build-many-glibcs: relax version check to allow non-digit characters
DJ Delorie
dj@redhat.com
Wed Jan 31 21:42:00 GMT 2024
Fangrui Song <maskray@google.com> writes:
> A version string may contain non-digit characters, commonly found in
> built-from-VCS tools, e.g.
And we assume that these extra characters are not part of the
comparable, hopefully monotonically-increasing, portion of the version
number ;-)
> -def get_version_common(progname,line,word,delchars,arg1):
> +def get_version_common(progname,line,word,arg1):
Ok.
> v = out.stdout.splitlines()[line].split()[word]
> - if delchars:
> - v = v.replace(delchars,'')
> + v = re.match(r'[0-9]+(.[0-9]+)*', v).group()
> return [int(x) for x in v.split('.')]
I confirmed that this will include the first number despite it not being
in ()'s. Ok.
> -def get_version_common_stderr(progname,line,word,delchars,arg1):
> +def get_version_common_stderr(progname,line,word,arg1):
Ok.
> - if delchars:
> - v = v.replace(delchars,'')
> + v = re.match(r'[0-9]+(.[0-9]+)*', v).group()
Ok.
> def get_version(progname):
> - return get_version_common (progname, 0, -1, None, '--version');
> + return get_version_common(progname, 0, -1, '--version');
>
> def get_version_awk(progname):
> - return get_version_common (progname, 0, 2, ',', '--version');
> + return get_version_common(progname, 0, 2, '--version');
>
> def get_version_bzip2(progname):
> - return get_version_common_stderr (progname, 0, 6, ',', '-h');
> + return get_version_common_stderr(progname, 0, 6, '-h');
Ok.
LGTM.
Reviewed-by: DJ Delorie <dj@redhat.com>
More information about the Libc-alpha
mailing list