lmco / laikaboss

Laika BOSS: Object Scanning System
Apache License 2.0
732 stars 155 forks source link

META_EXIFTOOL MAC time error #81

Closed jh1113 closed 3 years ago

jh1113 commented 3 years ago

hi I have a question about exiftool at laika.py.

When scanning a file, the MAC in exiftool displays the current time.

image

image

Do you know how to solve this?

thank you

agrajag9 commented 3 years ago

Exactyly which field is wrong? They look fine. The Access time is the time of last access, which would correctly be the current time since that's when it was accessed.

agrajag9 commented 3 years ago

Can you compare with the output from stat?

jh1113 commented 3 years ago

@agrajag9 Thank you for your answer.

The metadata in the test file is as follows. FileName: origin.jpg FileModifyDate: 2019:11:12 13:31:24+09:00

image

The exiftool results in this file also derive the same value. image

Current time: 2021:08:30 09:07 +9 image

However, extracting metadata from this file via laika.py results in the following:

image

This file has yet to be accessed or modified. However, the MAC outputs the current time.

agrajag9 commented 3 years ago

Aha! I see the issue now!

TLDR: This is expected behavior.

If you look right above the datetimes, you'll notice a key named SourceFile with the value "/dev/shm/laikaboss_tmp/tmptTw72U" (or something like that, I can't quite read it), but you submitted the file ~/DosTest/origin.jpg. What you're seeing is that LaikaBOSS copies ~/DosTest/origin.jpg into /dev/shm/laikaboss_tmp/ before scanning. This is because the file may get read many times and /dev/shm/ is actually a tmpfs in memory and by putting a copy of the file there we significantly reduce the number of filesystem calls which are notoriously expensive. So META_EXIFTOOL isn't actually pointed at ~/DosTest/origin.jpg like you expect, but at a copy of it at /dev/shm/laikaboss_tmp/tmptTw72U, which was just created - hence the time mismatches.

And for what it's worth, META_EXIFTOOL doesn't actually do any EXIF parsing itself, it relies on the 3rd-party exiftool module: https://github.com/lmco/laikaboss/blob/master/laikaboss/modules/meta_exiftool.py#L45-L46

jh1113 commented 3 years ago

@agrajag9

Oh, thank you. I understand, then do you know what to do to get the datatime printed correctly?