[PATCH] linux: fix ntp_gettime abi break
Carlos O'Donell
carlos@redhat.com
Thu Mar 2 17:47:21 GMT 2023
On 2/20/23 23:04, Kacper Piwiński via Libc-alpha wrote:
> Between versions v2.11 and v2.12 struct ntptimeval got new fields.
> That wasn't a problem because new function ntp_gettimex was created
> (and made default) to support new struct. Old ntp_gettime was not
> using new fields so it was safe to call with old struct
> definition. Then between versions v2.31 and v2.32 when working on
> y2038 bugs, ntp_gettime start setting new fields.
>
> Sets fields manually to maintain compatibility with v2.11 struct definition.
The patch fails to apply.
This fails pre-commit CI:
https://patchwork.sourceware.org/project/glibc/patch/CAKVti-BRav=mmfcQBEz_qpezmKfR_fFW9uihJb+QXiJazugTmA@mail.gmail.com/
Please have a look at:
https://sourceware.org/glibc/wiki/Contribution%20checklist
Did you generate the patch with `git format-patch`?
>
> Author: Kacper Piwiński <vfjpl1@gmail.com>
> ---
> sysdeps/unix/sysv/linux/ntp_gettime.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/sysdeps/unix/sysv/linux/ntp_gettime.c
> b/sysdeps/unix/sysv/linux/ntp_gettime.c
> index 4879573530..3844b2e487 100644
> --- a/sysdeps/unix/sysv/linux/ntp_gettime.c
> +++ b/sysdeps/unix/sysv/linux/ntp_gettime.c
> @@ -54,7 +54,11 @@ __ntp_gettime (struct ntptimeval *ntv)
> int result;
>
> result = __ntp_gettime64 (&ntv64);
> - *ntv = valid_ntptimeval64_to_ntptimeval (ntv64);
> + //manually update fields to maintain abi with v2.11 struct definition
> + struct ntptimeval tntv = valid_ntptimeval64_to_ntptimeval (ntv64);
> + ntv->time = tntv.time;
> + ntv->maxerror = tntv.maxerror;
> + ntv->esterror = tntv.esterror;
>
> return result;
> }
> --
> 2.38.1.windows.1
>
--
Cheers,
Carlos.
More information about the Libc-alpha
mailing list