Skip to content

ICU-21392 Fix Windows Time Zone detection when more than one possible time zone. - #1465

Merged
jefgen merged 1 commit into
unicode-org:maint/maint-68from
jefgen:user/jefgen/fix-wintz-detection-bug
Nov 13, 2020
Merged

jefgen merged 1 commit into
unicode-org:maint/maint-68from
jefgen:user/jefgen/fix-wintz-detection-bug

Conversation

@jefgen

@jefgen jefgen commented Nov 12, 2020 •

Copy link
Copy Markdown
Member

This PR is a fix for the regression caused by the change in PR #1362.

The list of possible time zones returned is a space-delimited list in some cases.
The change in PR #1362 was only stopping at the null-terminator. Instead we need to stop at the first space.

I missed this when reviewing the changes in PR #1297.

The issue is due to the removal of the check here on this line which was stopping at the null or space:
https://github.com/unicode-org/icu/pull/1297/files#diff-04dfe6b718cf7d1421df2b6ff3aa89d0b95a7e2d468f5eb323e3698557a3a936L106

Checklist

@jefgen
jefgen force-pushed the user/jefgen/fix-wintz-detection-bug branch from d2efa64 to 9b5b9c1 Compare November 12, 2020 19:29
@jira-pull-request-webhook

Copy link
Copy Markdown

Notice: the branch changed across the force-push!

  • icu4c/source/common/wintz.cpp is different

View Diff Across Force-Push

~ Your Friendly Jira-GitHub PR Checker Bot

markusicu
markusicu previously approved these changes Nov 12, 2020

@markusicu markusicu left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

lgtm

FrankYFTang
FrankYFTang previously approved these changes Nov 12, 2020

@FrankYFTang FrankYFTang left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We need to think about how to unit test these codes....

@jefgen

jefgen commented Nov 12, 2020 •

Copy link
Copy Markdown
Member Author

We need to think about how to unit test these codes....

FIWW, I think that unit testing is a good idea -- but it's somewhat tricky as this function directly calls platform APIs like the registry and such.

If we had something like Detours to support mocking the Win32 platform APIs directly, then it would be easier. But I don't know if we want to use another library just to test one function.

FYI: @FrankYFTang: I've file a follow-up bug to think some more about how to better test this code:
https://unicode-org.atlassian.net/browse/ICU-21393

@jefgen
jefgen requested a review from axelandrejs November 12, 2020 19:50
daniel-ju-msft
daniel-ju-msft previously approved these changes Nov 12, 2020
@jefgen

jefgen commented Nov 12, 2020

Copy link
Copy Markdown
Member Author

Thanks for the reviews!
Should I wait for the CI builds (Travis & AppVeyor) to finish -- or should I merge now anyways?

Comment thread icu4c/source/common/wintz.cpp Resolved
@jefgen
jefgen force-pushed the user/jefgen/fix-wintz-detection-bug branch from 9b5b9c1 to f9bc0a0 Compare November 12, 2020 21:47
@jira-pull-request-webhook

Copy link
Copy Markdown

Notice: the branch changed across the force-push!

  • icu4c/source/common/wintz.cpp is different

View Diff Across Force-Push

~ Your Friendly Jira-GitHub PR Checker Bot

@jefgen
jefgen force-pushed the user/jefgen/fix-wintz-detection-bug branch from f9bc0a0 to d3a989c Compare November 12, 2020 21:47
@jira-pull-request-webhook

Copy link
Copy Markdown

Notice: the branch changed across the force-push!

  • icu4c/source/common/wintz.cpp is different

View Diff Across Force-Push

~ Your Friendly Jira-GitHub PR Checker Bot

@jefgen jefgen mentioned this pull request Nov 12, 2020
3 of 5 tasks
@jefgen
jefgen merged commit a78b49b into unicode-org:maint/maint-68 Nov 13, 2020
@jefgen
jefgen deleted the user/jefgen/fix-wintz-detection-bug branch November 13, 2020 08:13
@sffc

sffc commented Dec 3, 2020

Copy link
Copy Markdown
Member

CC @mj1856

@FrankYFTang

Copy link
Copy Markdown
Contributor

It seems we see new problem coming in related to this when we start to roll out chrome. Which version of Windows have you test your code on? Would it work on older version of Windows? https://bugs.chromium.org/p/chromium/issues/detail?id=1168528

@jefgen

jefgen commented Jan 21, 2021

Copy link
Copy Markdown
Member Author

Which version of Windows have you test your code on? Would it work on older version of Windows?

Yes, it should work on older versions of Windows as well.

FWIW, I tested the change on the following versions:

  • Windows 7 SP1 build 6.1.7601
  • Windows 10 19H1 build 18363.418
  • Windows 10 20H2 build 19042.631

I can't repo the issue anymore with the fix. I'll add a comment to the Cr bug, but I think we'll probably need more info in order to understand what might be the issue.

@markusicu

markusicu commented Jan 27, 2021 •

Copy link
Copy Markdown
Member

Rather it was an issue in the changes for ICU-13845. There is a fix and more details in PR #1538.

PR #1538 is unrelated. I assume you mean PR #1539 / PR #1543?

@jefgen

jefgen commented Jan 27, 2021

Copy link
Copy Markdown
Member Author

PR #1538 is unrelated. I assume you mean PR #1539 / PR #1543?

Yes, sorry for the confusion. I'll edit the comment above to fix it. Thanks.

@jefgen

jefgen commented Jan 27, 2021 •

Copy link
Copy Markdown
Member Author

Actually, it seems that editing the comment does not remove the link on GitHub... I'm going to delete the comment instead.

Update: And it seems that deleting the comment doesn't remove the link either. :(

In any case, here's the updated comment:

https://bugs.chromium.org/p/chromium/issues/detail?id=1168528

Just to add an update on this PR:
For the Chromium bug, it's not related to this PR. Rather it was an issue in the changes for ICU-13845. There is a fix and more details in PR #1539 and PR #1543.

jefgen added a commit to microsoft/icu that referenced this pull request Jan 28, 2021
This change cherry-picks the upstream fix for the issue of the Windows
Time Zone offset being wrong when Automatic DST setting is OFF in the Control Panel.

ICU-21465 Windows Time Zone offset is wrong when Automatic DST setting is OFF
https://unicode-org.atlassian.net/browse/ICU-21465

Cherry-picked from upstream commit: c6934ff7476200fc22abdf4300c94e2a3460c793

The upstream PR into master is here:
unicode-org/icu#1465

The upstream PR into maint/maint-68 is here:
unicode-org/icu#1543
jefgen added a commit to microsoft/icu that referenced this pull request Jan 29, 2021
…65)

This change cherry-picks the upstream fix for the issue of the Windows
Time Zone offset being wrong when Automatic DST setting is OFF in the Control Panel.

ICU-21465 Windows Time Zone offset is wrong when Automatic DST setting is OFF
https://unicode-org.atlassian.net/browse/ICU-21465

Cherry-picked from upstream commit: c6934ff7476200fc22abdf4300c94e2a3460c793

The upstream PR into master is here:
unicode-org/icu#1465

The upstream PR into maint/maint-68 is here:
unicode-org/icu#1543

Detailed Description:
This fixes a bug in the changes for ICU-13845, for handling when the "Automatic DST" setting is OFF in the Control Panel.

It turns out that the offset value for the calculated time zone when the "Automatic DST" setting is turn off is wrong. The sign for the time zone offset is flipped. (It's positive when it should be negative, and vice-versa).

I think this was perhaps due to confusion about the value for the UTC offset, how POSIX style offsets are handled, and what is reported by the Win32 API `GetDynamicTimeZoneInformation`. It seems that this issue was actually present in the original PR for ICU-13845 and it was missed in the reviews on the other PR for the ticket.
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.

6 participants