01-20-07 12:23 PM
Stephane CHAZELAS wrote:
> 2007-01-12, 17:22(+01), Michael Tosch:
>
> And again, it probably doesn't make sense. First the file will
> probably be written down to physical storage (if permanent
> storage there is) long after the cmp command has returned, and
> second, even the filesystem is configured to synchronously write
> to disk, cmp's read()s will probably not ask the system to read
> the data from disk as it will already be in cache, and even if
> it's not one of the kernel layer caches, it may be in the disk
> cache, and even if the data is not corrupted on disk at this
> very moment, it may very well become corrupted the next minute.
A most excellent point. It only makes sense to do the "cmp"s after a
whole batch of copies has completed and hope the first of the batch of
files has been flushed out of the cache. I hadn't thought of that. I'm
glad I read your post here.
> [...]
>
> That's the only sensible thing to do, though you forgot the
> "--".
>
> cp -- "$file" "$dest" || exit
> cp -- "$file" "$dest" || take-corrective-action
>
> (cp will already have output an error message, no need to add
> one).
>=20
> --=20
> St=E9phane
[ Post a follow-up to this message ]
|