On Wed, Jan 6, 2010 at 1:32 PM, Leonid Flaks flaks@bnl.gov wrote:
Alex Wood wrote:
This patch makes sure file time stamp and file permissions are preserved.
The patch is attached and is also at http://github.com/lflaks/cobbler/
Leonid,
You're using cp's -a flag here which does a lot more than just preserving the mode and timestamps. For example, -a changes the behavior of cp with regard to symlinks.
How would you feel about using -p instead which preserves the mode, ownership, and timestamps?
Regards, Alex
I am not sure if -p would do the job. The point of that change was that original version was inconsistent. In order to save files we first copy them into /tmp and then after installation was done, copy them back into hard drive. If we used -a option in the first step, we should use it on the second step also, otherwise it makes no sense. We can use -p, but then it should be the same in both places. Those 3 snippets are saving very specific files each and there are no symlinks in there. However, I was thinking of making some more generic snippet, in which user just enters the data that he/she wants to save. It could be shell glob or list of globs. In this case we need to think what we want cp to do, as we have no idea what could be in that preserved data. Actually, looking at cp man page, I see that -p does not preserve context, also -R option (part of -a) would traverse directories recursively - useful for that generic snippet.
Looks like I made probably more confusing then clear ;-(
Leon
If you plan to use globs and (by design) multiple files the only way I see to properly do this is to use tar or something similar. Granted the current keep_ssh_host_keys snippet is far better than I'd ever imagined when originally submitting it but replacing it with a generic one is a noteworthy goal.