Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lib/, src/: Use local time for human-readable dates #1058

Merged
merged 1 commit into from
Aug 1, 2024

Conversation

alejandro-colomar
Copy link
Collaborator

That is, use localtime_r(3) instead of gmtime_r(3).

Closes: #1057
Reported-by: @kenion
Cc: @hallyn
Cc: @eggert

That is, use localtime_r(3) instead of gmtime_r(3).

Closes: <shadow-maint#1057>
Reported-by: Gus Kenion <https://github.com/kenion>
Cc: Serge Hallyn <serge@hallyn.com>
Cc: Paul Eggert <eggert@cs.ucla.edu>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
@alejandro-colomar alejandro-colomar marked this pull request as ready for review July 31, 2024 12:38
@alejandro-colomar alejandro-colomar requested a review from hallyn July 31, 2024 13:01
Copy link
Member

@hallyn hallyn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems right to me, but will leave for someone else to merge to make sure that yet another person thinks about it :)

@hallyn hallyn requested review from jubalh and ikerexxe August 1, 2024 00:29
Copy link
Member

@jubalh jubalh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems good! Thanks for PR!

Copy link
Collaborator

@ikerexxe ikerexxe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Merging it.

@ikerexxe ikerexxe merged commit 3f5b4b5 into shadow-maint:master Aug 1, 2024
9 checks passed
@hallyn
Copy link
Member

hallyn commented Aug 1, 2024

Thanks guys :)

@alejandro-colomar
Copy link
Collaborator Author

Thank you all for reviewing! :)

@alejandro-colomar alejandro-colomar mentioned this pull request Aug 3, 2024
@alejandro-colomar alejandro-colomar deleted the localtime branch August 9, 2024 10:38
alejandro-colomar added a commit to alejandro-colomar/shadow that referenced this pull request Feb 14, 2025
This reverts commit 3f5b4b5.

The dates are stored as UTC, and are stored as a number of days since
Epoch.  We don't have enough precision to translate it into local time.
Using local time has caused endless issues in users.

This patch is not enough for fixing this issue completely, since
printing a date without time-zone information means that the date is a
local date, but what we're printing is a UTC date.  A future patch
should add time-zone information to the date.

For now, let's revert this change that has caused so many issues.

Fixes: 3f5b4b5 (2024-08-01; "lib/, src/: Use local time for human-readable dates")
Link: <https://github.com/ansible/ansible/blob/devel/test/integration/targets/user/tasks/test_expires.yml#L2-L20>
Link: <https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1095430>
Link: <https://lists.iana.org/hyperkitty/list/tz@iana.org/message/ENE5IFV3GAH6WK22UJ6YU57D6TQINSP5/>
Link: <shadow-maint#1202>
Link: <shadow-maint#1057>
Link: <shadow-maint#939>
Link: <shadow-maint#1058>
Link: <shadow-maint#1059 (comment)>
Link: <shadow-maint#952>
Link: <shadow-maint#942>
Reported-by: Chris Hofstaedtler <zeha@debian.org>
Reported-by: Gus Kenion <https://github.com/kenion>
Reported-by: Alejandro Colomar <alx@kernel.org>
Reported-by: Michael Vetter <jubalh@iodoru.org>
Reported-by: Lee Garrett <lgarrett@rocketjump.eu>
Cc: Paul Eggert <eggert@cs.ucla.edu>
Cc: Tim Parenti <tim@timtimeonline.com>
Cc: Iker Pedrosa <ipedrosa@redhat.com>
Cc: "Serge E. Hallyn" <serge@hallyn.com>
Cc: Brian Inglis <Brian.Inglis@SystematicSW.ab.ca>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
alejandro-colomar added a commit to alejandro-colomar/shadow that referenced this pull request Feb 16, 2025
This reverts commit 3f5b4b5.

The dates are stored as UTC, and are stored as a number of days since
Epoch.  We don't have enough precision to translate it into local time.
Using local time has caused endless issues in users.

This patch is not enough for fixing this issue completely, since
printing a date without time-zone information means that the date is a
local date, but what we're printing is a UTC date.  A future patch
should add time-zone information to the date.

For now, let's revert this change that has caused so many issues.

Fixes: 3f5b4b5 (2024-08-01; "lib/, src/: Use local time for human-readable dates")
Link: <https://github.com/ansible/ansible/blob/devel/test/integration/targets/user/tasks/test_expires.yml#L2-L20>
Link: <https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1095430>
Link: <https://lists.iana.org/hyperkitty/list/tz@iana.org/message/ENE5IFV3GAH6WK22UJ6YU57D6TQINSP5/>
Link: <shadow-maint#1202>
Link: <shadow-maint#1057>
Link: <shadow-maint#939>
Link: <shadow-maint#1058>
Link: <shadow-maint#1059 (comment)>
Link: <shadow-maint#952>
Link: <shadow-maint#942>
Reported-by: Chris Hofstaedtler <zeha@debian.org>
Reported-by: Gus Kenion <https://github.com/kenion>
Reported-by: Alejandro Colomar <alx@kernel.org>
Reported-by: Michael Vetter <jubalh@iodoru.org>
Reported-by: Lee Garrett <lgarrett@rocketjump.eu>
Cc: Paul Eggert <eggert@cs.ucla.edu>
Cc: Tim Parenti <tim@timtimeonline.com>
Cc: Iker Pedrosa <ipedrosa@redhat.com>
Cc: "Serge E. Hallyn" <serge@hallyn.com>
Cc: Brian Inglis <Brian.Inglis@SystematicSW.ab.ca>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
alejandro-colomar added a commit to alejandro-colomar/shadow that referenced this pull request Feb 25, 2025
This reverts commit 3f5b4b5.

The dates are stored as UTC, and are stored as a number of days since
Epoch.  We don't have enough precision to translate it into local time.
Using local time has caused endless issues in users.

This patch is not enough for fixing this issue completely, since
printing a date without time-zone information means that the date is a
local date, but what we're printing is a UTC date.  A future patch
should add time-zone information to the date.

For now, let's revert this change that has caused so many issues.

Fixes: 3f5b4b5 (2024-08-01; "lib/, src/: Use local time for human-readable dates")
Link: <https://github.com/ansible/ansible/blob/devel/test/integration/targets/user/tasks/test_expires.yml#L2-L20>
Link: <https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1095430>
Link: <https://lists.iana.org/hyperkitty/list/tz@iana.org/message/ENE5IFV3GAH6WK22UJ6YU57D6TQINSP5/>
Link: <shadow-maint#1202>
Link: <shadow-maint#1057>
Link: <shadow-maint#939>
Link: <shadow-maint#1058>
Link: <shadow-maint#1059 (comment)>
Link: <shadow-maint#952>
Link: <shadow-maint#942>
Reported-by: Chris Hofstaedtler <zeha@debian.org>
Reported-by: Gus Kenion <https://github.com/kenion>
Reported-by: Alejandro Colomar <alx@kernel.org>
Reported-by: Michael Vetter <jubalh@iodoru.org>
Reported-by: Lee Garrett <lgarrett@rocketjump.eu>
Cc: Paul Eggert <eggert@cs.ucla.edu>
Cc: Tim Parenti <tim@timtimeonline.com>
Cc: "Serge E. Hallyn" <serge@hallyn.com>
Cc: Brian Inglis <Brian.Inglis@SystematicSW.ab.ca>
Reviewed-by: Iker Pedrosa <ipedrosa@redhat.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
alejandro-colomar added a commit that referenced this pull request Feb 25, 2025
This reverts commit 3f5b4b5.

The dates are stored as UTC, and are stored as a number of days since
Epoch.  We don't have enough precision to translate it into local time.
Using local time has caused endless issues in users.

This patch is not enough for fixing this issue completely, since
printing a date without time-zone information means that the date is a
local date, but what we're printing is a UTC date.  A future patch
should add time-zone information to the date.

For now, let's revert this change that has caused so many issues.

Fixes: 3f5b4b5 (2024-08-01; "lib/, src/: Use local time for human-readable dates")
Link: <https://github.com/ansible/ansible/blob/devel/test/integration/targets/user/tasks/test_expires.yml#L2-L20>
Link: <https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1095430>
Link: <https://lists.iana.org/hyperkitty/list/tz@iana.org/message/ENE5IFV3GAH6WK22UJ6YU57D6TQINSP5/>
Link: <#1202>
Link: <#1057>
Link: <#939>
Link: <#1058>
Link: <#1059 (comment)>
Link: <#952>
Link: <#942>
Reported-by: Chris Hofstaedtler <zeha@debian.org>
Reported-by: Gus Kenion <https://github.com/kenion>
Reported-by: Alejandro Colomar <alx@kernel.org>
Reported-by: Michael Vetter <jubalh@iodoru.org>
Reported-by: Lee Garrett <lgarrett@rocketjump.eu>
Cc: Paul Eggert <eggert@cs.ucla.edu>
Cc: Tim Parenti <tim@timtimeonline.com>
Cc: "Serge E. Hallyn" <serge@hallyn.com>
Cc: Brian Inglis <Brian.Inglis@SystematicSW.ab.ca>
Reviewed-by: Iker Pedrosa <ipedrosa@redhat.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

chage -d YYYY-MM-DD off by one
4 participants