Re: Bug in fat-fs code: file date/time wrong

Peter Daum (gator@cs.tu-berlin.de)
Sun, 14 Nov 1999 12:12:24 +0100 (MET)


On Sun, 14 Nov 1999, Joe Zbiciak wrote:

> Peter, Edgar,
>
> I was reading the thread on linux-kernel regarding the date/time
> stamp problems that a handful of the filesystems have. (Notably,
> FAT, ISO9660, and HPFS).
>
> I was wondering, could this be fixed via a mount option? eg. At mount
> time, mount could pass what the current GMT offset was as a hidden
> mount option, and the user could override by specifying "-o
> minuteswest=XXX" if they so desired.
>
> The only place I see that this breaks is when the system is up across a
> DST boundary. I suppose a suitable cron-job could call "mount -o
> remount" to fix, with only a minor race at midnight.
>
> Thoughts?
>
> I'm interested in seeing this fixed, since I sometimes need to
> move source trees between DOS and Linux, and make complains when
> files appear to travel backwards in time. :-)

Hi Joe,

As Edgar pointed out, the current code for FAT already permits an
(ab-)use similar to what you propose. It is a gross hack, but for
the moment that's also what I am doing to at least partially work
around the problem:

if (gettimeofday(&tv, &tz)) die("getting time");
now=time(0);
t=localtime(&now);
tz.tz_dsttime=(t->tm_isdst);
tz.tz_minuteswest=MINUTESWEST;
if (settimeofday(&tv, &tz)) die("setting time");

If you execute this prior to mounting a FAT file system, it will
at least for dates in the current DST interval show correct file
date/time.

> PS: I don't subscribe to lk... I just read the archives online.
[ I sent a copy of this mail to the list ]

Regards,
Peter

-- 
                                             __o  
     Peter Daum <gator at cs.tu-berlin.de> _'\<_ 
       - pgp messages welcome -       ____(_)/(_)

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/