[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: question about copy
From: |
Mark R. Lindsey |
Subject: |
Re: question about copy |
Date: |
Thu, 28 Sep 2000 21:20:48 -0400 |
: copy:
: ${masterfiles}/foo
: dest=${testdir}/foo
: type=mtime
: mode=0444
:
: If I change the file ${masterfiles}/foo, the dest file is overwritten
: with the master copy. If I modify the ${testdir}/foo file, nothing
: happens,
If you specify an mtime-type copy, cfengine copies ${masterfiles}/foo
to ${testdir}/foo if-and-only-if ${masterfiles}/foo was modified *after*
${testdir}/foo. Stated differently, it makes its decision like this:
ok_to_copy = (deststatbuf.st_mtime < sourcestatbuf.st_mtime)
(from image.c)
When you modify ${masterfiles}/foo, its mtime is updated, so
it's `newer' than ${testdir}/foo, so cfengine will copy it.
When you modify ${testdir}/foo, its mtime is updated, so it's
`newer' than ${masterfiles}/foo. But cfengine doesn't care.
: I was under the impression from the docs that if there was a
: difference between the files, the dest copy would be updated with the
: master-file.
It sounds like what you want is a byte-for-byte comparison, either
with a `byte'-type copy, or a `checksum'-type copy.
: "An 'mtime' comparison does not take into account changes of file
: permissions, only modifications to the contents of the files"
Being really, really picky, I'd guess that this statement is not quite
accurate. cfengine (as I understand the code) trusts the operating system
to give it the mtime; strictly speaking, the mtime is distinct from the
contents of the files, and can be manipulated. So with an mtime-type
copy, cfengine isn't actually taking into account ``modifications to the
contents of the files'' -- it's only comparing the modification times
that the operating system gives it for the two files.
Like I mentioned, cfengine will gladly compare the contents of the files
with type=checksum or type=byte copies.