-
Notifications
You must be signed in to change notification settings - Fork 313
Fixes for the UniversalTime extra field #421
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
Conversation
Sorry to bump this, but would you mind having a look @jdleesmiller? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the slow turnaround. Nice improvements 👍. Just a few comments.
When a timestamp is set/unset the flags should reflect this.
From the documentation: "The time values are in standard Unix signed-long format, indicating the number of seconds since 1 January 1970 00:00:00." The three time values were being unpacked with 'VVV', which is unsigned 32-bit, but they should be unpacked with 'l<l<l<': signed-long little endian.
From the documentation: "...times that are present will appear in the order indicated, but any combination of times may be omitted. (Creation time may be present without access time, for example.)" This fixes the parsing so that the times are read into the correct fields, according to the flags. Before they were simply assumed to be in order and all present.
ee0a718
to
ee028d2
Compare
Thanks for the review. I have made the above fixes and have rebased onto current |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice 👍 . Looks good.
When working on #413 to fix #395 I discovered that there were a few problems with how the timestamps were being stored - particularly with the UniversalTime extra field. On even closer inspection, and after having consulted the UniversalTime specification (ftp://ftp.info-zip.org/pub/infozip/doc/), I found further issues.
This PR fixes those issues and makes the
UniversalTime
class more user-friendly. It also adds tests.At a later date I will fold this in so that it is used to store and restore the timestamps of files, but I've left this for now as it has the side-effect of adding data (that might be unexpected/unwanted) between the filename and file data. In short, I wonder if we should allow some control over which extra fields are used, rather than inserting them by default, c.f. #398.