Daemon News Ezine BSD News BSD Mall BSD Support Forum BSD Advocacy BSD Updates

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Why does ls report wrong creation date on symlinks?



>> I had previously noted that all directories in a MSDOSFS tree carry
>> as their creation date, the current moment.  Somebody suggested that
>> this was a capricious choice, in view of the impossibility of
>> duplicating the creation date which DOS would report.  I wonder
>> if there is a link between these two bugs.

No, there is no link between them.  I fixed msdosfs in FreeBSD-current
to report the same date for directories as DOS does.  DOS never changes
the date for directories after it creates them.  This isn't as close
as possible to POSIX conformance, but neither is stamping directories
with the current timestamp.

>UNIX and UNIX like OS's (and POSIX implementing OS's, for that matter)
>don't keep an absolute file creation time.  They keep a change time
>(file metadata -- "stat information" -- has changed), a modification
>time (file contents have changed), and an access time (a read operation
>has occurred on the file).

DOS keeps only one timestamp, which is the modification time for files
and the creation time for directories.

>What you are seeing is not a creation date, unless you are directly
>accessing the file system directory blocks in the DOS FS.  Instead,
>depending on your options to 'ls', you are seeing one of the dates
>the is reported in a POSIX compliant FS, but which DOS does not
>maintain (the modification time).

ls reports the modification time by default, and stat() fills in the
times for directories as follows:

		FreeBSD-1.1.5	FreeBSD-2.0	FreeBSD-current
	atime	creation time	creation time	creation time
	ctime	creation time	current time	creation time
	mtime	creation time	current time	creation time

Other msdfosfs implementations change the directory time when the
directory is modified.  The FreeBSD-2.0 implementation goes to
special trouble to avoid changing it.  There should be a mount
option to control the behaviour.

>It is precisely the fact that a DOS file system can not store all of
>the date information required by POSIX that makes it impossible to
>produce a POSIX compliant DOS file system.  The DOS FS simply can
>not comply with the POSIX "shall mark for update" and "shall update"
>directives.

>POSIX leaves a loophole, allowing read-only media to ignore the
>update requirements -- so you can be technically compliant if you
>mount the disk read-only.  Very useful.  8-).

Pretending that directories were modified at the current time breaks
even this :-).

Bruce