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

zip: last_modification_date and last_modification_time are mislabeled or swapped #792

Closed
TomiBelan opened this issue Oct 21, 2023 · 2 comments · Fixed by #793
Closed

zip: last_modification_date and last_modification_time are mislabeled or swapped #792

TomiBelan opened this issue Oct 21, 2023 · 2 comments · Fixed by #793

Comments

@TomiBelan
Copy link

What version are you using (fq -v)?

$ fq -v
0.8.0 (linux amd64)

How was fq installed?

Downloaded from https://github.com/wader/fq/releases/download/v0.8.0/fq_0.8.0_linux_amd64.tar.gz

Can you reproduce the problem using the latest release or master branch?

I didn't try

What did you do?

./fq d file.zip

What result did you expect?

Dates should consist of year+month+day and times should consist of hour+minute+second. Not vice versa.

I don't know which one is really which in the zip format.

What did you see instead?

          |                                                                 |                      |      last_modification_date{}:
0x00000000|                              03                                 |          .           |        hours: 0
0x00000000|                              03 6c                              |          .l          |        minutes: 27
0x00000000|                                 6c                              |           l          |        seconds: 12
          |                                                                 |                      |      last_modification_time{}:
0x00000000|                                    55                           |            U         |        year: 42
0x00000000|                                    55 57                        |            UW        |        month: 10
0x00000000|                                       57                        |             W        |        day: 23
wader added a commit that referenced this issue Oct 21, 2023
MSDOS time/date was read in wrong order and also did not take into account
that the bit ranges in the shortis are in little-endian.

Remodel modification_time/date to be one struct with fat_time, fat_date LE shorts
and then synthetic values for day, hours, minute etc and also a unix field with the
timestamp as unix time.

Also refactor and clenaup extra fields/extended code a bit.

Fixes #792
@wader
Copy link
Owner

wader commented Oct 21, 2023

@TomiBelan Hey! thanks for the report. Yes that seem very wrong and it seems i also did not take into account that the bit ranges are in a 16bit LE number.

If possible could you try #793 and see if things looks more correct?

wader added a commit that referenced this issue Oct 21, 2023
MSDOS time/date was read in wrong order and also did not take into account
that the bit ranges in the shortis are in little-endian.

Remodel modification_time/date to be one struct with fat_time, fat_date LE shorts
and then synthetic values for day, hours, minute etc and also a unix field with the
timestamp as unix time.

Also refactor and clenaup extra fields/extended code a bit.

Fixes #792
wader added a commit that referenced this issue Oct 21, 2023
MSDOS time/date was read in wrong order and also did not take into account
that the bit ranges in the shortis are in little-endian.

Remodel modification_time/date to be one struct with fat_time, fat_date LE shorts
and then synthetic values for day, hours, minute etc and also a unix field with the
timestamp as unix time.

Also refactor and clenaup extra fields/extended code a bit.

Fixes #792
@wader
Copy link
Owner

wader commented Oct 21, 2023

If you have golang installed you should be able to run the PR branch using:

go run github.com/wader/fq@zip-correct-date-time-fields d file.zip

wader added a commit that referenced this issue Oct 21, 2023
MSDOS time/date was read in wrong order and also did not take into account
that the bit ranges in the shortis are in little-endian.

Remodel modification_time/date to be one struct with fat_time, fat_date LE shorts
and then synthetic values for day, hours, minute etc and also a unix field with the
timestamp as unix time.

Also refactor and clenaup extra fields/extended code a bit.

Fixes #792
wader added a commit that referenced this issue Oct 22, 2023
MSDOS time/date was read in wrong order and also did not take into account
that the bit ranges in the shortis are in little-endian.

Remodel modification_time/date to be one struct with fat_time, fat_date LE shorts
and then synthetic values for day, hours, minute etc and also a unix field with the
timestamp as unix time.

Also refactor and clenaup extra fields/extended code a bit.

Fixes #792
wader added a commit that referenced this issue Oct 22, 2023
MSDOS time/date was read in wrong order and also did not take into account
that the bit ranges in the shortis are in little-endian.

Remodel modification_time/date to be one struct with fat_time, fat_date LE shorts
and then synthetic values for day, hours, minute etc and also a unix field with the
timestamp as unix time.

Also refactor and clenaup extra fields/extended code a bit.

Fixes #792
wader added a commit that referenced this issue Oct 23, 2023
MSDOS time/date was read in wrong order and also did not take into account
that the bit ranges in the shortis are in little-endian.

Remodel modification_time/date to be one struct with fat_time, fat_date LE shorts
and then synthetic values for day, hours, minute etc and also a unix field with the
timestamp as unix time.

Also refactor and clenaup extra fields/extended code a bit.

Fixes #792
wader added a commit that referenced this issue Oct 23, 2023
MSDOS time/date was read in wrong order and also did not take into account
that the bit ranges in the shortis are in little-endian.

Remodel modification_time/date to be one struct with fat_time, fat_date LE shorts
and then synthetic values for day, hours, minute etc and also a unix field with the
timestamp as unix time.

Also refactor and clenaup extra fields/extended code a bit.

Fixes #792
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 a pull request may close this issue.

2 participants