Incorrect DST handling when parsing file timestamps
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 48/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- cpp, linux, macos
- Domain
- operating-systems
Research direction
Start by locating the timestamp conversion code used on Windows and POSIX for old ZIP, RAR, and FAT timestamps. Compare the Windows APIs and POSIX mktime approach described in the issue, including the Windows 2000 compatibility constraint, then check existing timestamp tests or add cases for winter and summer dates. Done means conversions use the DST rule for the timestamp’s date and preserve the expected UTC time.
Written by the indexing model from the issue text.
Description
7-Zip uses LocalFileTimeToFileTime and FileTimeToLocalFileTime on Windows to convert between local time and UTC when working with formats that store timestamps in local time (old ZIP archives, RAR archives, FAT filesystems). The problem is, the former uses the current DST state to convert time instead of historical one, while the latter doesn't bother with accounting for DST at all. So, for example, if you're in Germany (UTC+1 during winter time) and you're on summer time, LocalFileTimeToFileTime will interpret all timestamps you pass into it as UTC+2, even something like January 5th, which should be interpreted as UTC+1. As such, extracting a file with such a modify date would result in the final timestamp being 1 hour off.
This affects Linux and Mac versions as well - while 7-Zip uses custom code there for conversion, it has the same problem where the current DST state is used instead of historical one.
On Windows, the solution is to use TzSpecificLocalTimeToSystemTime and SystemTimeToTzSpecificLocalTime, which do properly account for historical DST intervals, like was done here: https://github.com/dosbox-staging/dosbox-staging/pull/4339. The only problem is that TzSpecificLocalTimeToSystemTime does not exist on Windows 2000. On POSIX, I believe the proper course of action is to use mktime to find if DST was in effect during the specified local time.
- Dominant language
- C++
- Stars
- 4.6k
- Forks
- 519
- PR merge metrics
- No merged PRs in 30d
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from ip7z/7zip
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
Maintainers usually reply within 1 day
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
Maintainers usually reply within 1 day
-
area::installer documentation engine::sd enhancement wg::platform-core
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
lemonade-sdk/lemonade#4349 ·
Maintainers usually reply within 1 day
-
Python example: list a model's scenes and their camerasPossibly taken @rudraparmar76 claimed this today. Opendocumentation good first issue python
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
iamahsanmehmood/openskp#796 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
tenstorrent/tt-umd#4183 ·
Maintainers usually reply within 4 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
odelaneau/GLIMPSE#353 · 1 comment ·
Maintainers usually reply within 4 days