Bug 12756

Summary: hwclock --systz -u fails with error: Invalid argument
Product: Busybox Reporter: valere.monseur
Component: OtherAssignee: Sakib Sajal <sakib.sajal>
Status: RESOLVED FIXED    
Severity: normal CC: busybox-cvs
Priority: P5    
Version: 1.31.x   
Target Milestone: ---   
Hardware: All   
OS: Linux   
Host: Target:
Build:
Attachments: hwclock: make glibc v2.31 compatible (Fixes: 12756)

Description valere.monseur 2020-04-05 09:43:21 UTC
Hi,

I've recenctly upgraded my linux distribution (archlinux) that provides now gcc 9.3.0 and glibc 2.31.

Since the rebuild of busybox, hwclock returns an error like this:

# busybox hwclock --systz -u
hwclock: settimeofday: Invalid argument

It might be linked to glibc 2.31. I've found a related hwclock bug report in util-linux: https://github.com/karelzak/util-linux/commit/cd781c405be82540484da3bfe3d3f17a39b8eb5c

Could you please have a look and let me know what other information I need to provide?

Thanks
Regards,
V.
Comment 1 Sakib Sajal 2020-07-21 16:22:06 UTC
Created attachment 8546 [details]
hwclock: make glibc v2.31 compatible (Fixes: 12756)

I have attached the patch that makes hwclock compatible with glibc v2.31.
Comment 2 valere.monseur 2020-07-22 19:57:28 UTC
Thank you very much for the patch. It looks ok on my side.
Cheers,
V.
Comment 3 Sakib Sajal 2020-07-22 20:30:40 UTC
Thank you Valere for looking into it.
Comment 4 Aurelien Jarno 2020-08-02 11:09:24 UTC
This bug has been marked as RESOLVED FIXED, however I can't find the corresponding commit in the git. Could someone please point me at it? Thanks
Comment 5 valere.monseur 2020-08-03 19:11:20 UTC
Well, I tought that the patch provided would be integrated.
I have probably misunderstood => reopening.
Comment 6 Aurelien Jarno 2020-08-16 09:52:11 UTC
This has been fixed by the following commit:

commit 1a5d6fcbb5e606ab4acdf22afa26361a25f1d43b
Author: Eddie James <eajames@linux.ibm.com>
Date:   Mon Aug 10 09:59:02 2020 -0500

    hwclock: Fix settimeofday for glibc v2.31+
    
    The glibc implementation changed for settimeofday, resulting in "invalid
    argument" error when attempting to set both timezone and time with a single
    call. Fix this by calling settimeofday twice
    
    Signed-off-by: Eddie James <eajames@linux.ibm.com>
    Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>

Marking the bug as resolved.