[Bug 217560] FAT32 - Time stamp of file is one hour off

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Sun Mar 5 11:14:08 UTC 2017


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=217560

            Bug ID: 217560
           Summary: FAT32 - Time stamp of file is one hour off
           Product: Base System
           Version: 11.0-RELEASE
          Hardware: amd64
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: bin
          Assignee: freebsd-bugs at FreeBSD.org
          Reporter: erik at nordstroem.no

I live in time zone GMT + 1.

While trying something for another issue (#217440), I created a file on a FAT32
formatted USB stick using my Sony PlayStation 4.

The PlayStation 4 is showing the correct local time and I have verified that it
has its time zone configured correctly as "UTC+01:00 Oslo".

My laptop is showing the correct local time and I have the TZ env variable set
correctly as "Europe/Oslo".

I took a screenshot in the game Alien: Isolation on the PS4 and transferred it
to my USB stick.

I mounted the USB stick with

# mount_msdosfs -L en_US.UTF-8 /dev/da1s1 /mnt/

as per the discussion in issue #217440

but when I list the directory contents, the time stamp of the files is off by
one hour into the future compared to actual time when the file was created as
shown below. Note also that the file name itself contains the correct time when
the file was created. I transferred the file to my memory stick within minutes
of having taken the screenshot.

I don't have a windows system to create files from at the moment so I can't
verify whether this is a problem with FreeBSD handling of FAT32 or if the
incorrect timestamp was caused by the PS4.

I have attached an image of a minimal FAT32 partition which contains the
directory structure and the screenshot which was written to the USB stick by
the PS4.

The USB stick was prepared with

# umount /dev/da1s1
$ gpart delete -i 1 /dev/da1
$ gpart destroy /dev/da1
# dd if=/dev/zero of=/dev/da1 bs=16m
$ gpart create -s mbr /dev/da1
$ gpart add -t fat32 -s 4g -i 1 /dev/da1
# newfs_msdos -F32 /dev/da1s1
# sync

$ gpart show da1
=>      63  30277569  da1  MBR  (14G)
        63      8161       - free -  (4.0M)
      8224   8388608    1  fat32  (4.0G)
   8396832  21880800       - free -  (10G)

Unplugged the USB stick, put it in the PS4, took a screenshot and transferred
it to the USB stick. Put it back in the computer and made a minimal image of
the FAT32 partition;

# umount /dev/da1s1
$ dd if=/dev/da1s1 of=usbstick.img conv=sparse bs=16m count=1
$ hd usbstick.img > tmp.img
$ xxd -r tmp.img > usbstick.img
$ rm tmp.img
$ ls -hal usbstick.img
-rw-r--r--  1 erikn  erikn   1.5M Mar  5 12:10 usbstick.img

To mount the image;

# mdconfig -a -t vnode -f usbstick.img -u 0
# mount_msdosfs -L en_US.UTF-8 /dev/md0 /mnt/

Here we have the file with the mismatching timestamp.

$ ls -al /mnt/PS4/SHARE/Screenshots/Alien_\ Isolation™/
total 768
drwxrwxrwx  1 root  wheel   32768 Mar  5 13:07 ./
drwxrwxrwx  1 root  wheel   32768 Mar  5 13:07 ../
-rwxrwxrwx  1 root  wheel  305981 Mar  5 13:07 Alien_
Isolation™_20170305120653.jpg*

Unmount image;

# umount /dev/md0
# mdconfig -d -u 0

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-bugs mailing list