Bug 515 - File creation date is wrong
File creation date is wrong
Product: Samba 2.2
Classification: Unclassified
Component: File Services
All Linux
: P3 normal
: ---
Assigned To: Gerald (Jerry) Carter
Depends on:
  Show dependency treegraph
Reported: 2003-09-26 02:08 UTC by isojuttu
Modified: 2005-11-14 09:29 UTC (History)
0 users

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description isojuttu 2003-09-26 02:08:55 UTC
Lets assume today is 26.9.2003 (26th of September 2003).

The original file in WindowsXP has the following
date values:
Created: 23.9.2003
Modified: 21.9.2003
Accessed: 26.9.2003

Now, I copy that file inside WindowsXP to another
folder. E.g. from C:\ to C:\TEMP and it will get
the following values:
Created: 26.9.2003
Modified: 21.9.2003
Accessed: 26.9.2003

Notice how the created field changes.

Now again I take the original file and copy it
via samba to linux (redhat 9):
Created: 21.9.2003
Modified: 21.9.2003
Accessed: 21.9.2003

How come the created date is in the past? If I try
to think logically then isn't it so that when I copy
file to linux via samba, a new file is created? And
when new file is created then isn't it logical that the
creation date is today and not in the past?

Using the modified date affects at least some backup scripts.
E.g. You have a backup script to take incremental backup
of all the files which have changed since the last backup.
If the last backup time was 25th of Semptemer then it will
look for files which are newer than 25th of Semptember and
of course it doesn't backup any files which are copied to
linux via samba because their date is in the past.

I'm not sure that this is a "bug". It really depends how
you see things. I tried to look into smb.conf values, but
I couldn't find anything that would allow me to change
this behaviour.
Comment 1 Gerald (Jerry) Carter 2003-09-26 07:29:53 UTC
posix doersn't store the creation time.  This is one of 
the differences between posix and NTFS file system semantics.
So smbd has to fake the creation date based on one of the other
timestamp values (see the stat man page for details).
Comment 2 isojuttu 2003-09-28 23:12:15 UTC
Yes, I understand posix doesn't support creation time.
I am just wondering why smbd uses the modified time
and not current date? I don't see the logic behind
that solution. E.g.

If you have file foo.txt:
Sep 29 09:01 foo.txt

Now you say "cp foo.txt bar.txt" it becomes:
0 Sep 29 09:02 bar.txt

So when file is copied (inside linux or windows) the
creation/modification date is the current date. I think
we can agree on that :).

But samba doesn't work like that. Even though new file
is created, it uses the modified date information. If today
is 1st of Semptember 2003 then the file in windows might
have it's modified time 1st of January 2003. Now when that
file is copied to linux via samba, samba uses that modified
information. In my opinion linux and windows use the same
logic, but samba does not. That is why I first reported
this "bug".

Is there some reason you cannot use the current date when
file is copied to windows? If this is not considered as
a bug, maybe this could be added as feature request. Maybe
parameter in smb.conf to define whether to use the modified
timestamp or use current timestamp.
Comment 3 Gerald (Jerry) Carter 2005-11-14 09:29:34 UTC
database cleanup