Red Hat Bugzilla – Bug 181975
kudzu unnecessarily destroys configuration symlinks
Last modified: 2014-03-16 22:58:23 EDT
Description of problem:
When kudzu rewrites configuration files it unncessarily destroys symlinks
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1.ln -s inittab.hw1 inittab (or to other configs like fstab and modprobe.conf)
2.change some hardware to force change or delete something from
Any symlinked config files will become ordinary files
Symlinks should be preserved because that is why people use them .. they dont
want them to be destroyed .. otherwise people wouldnt create them in the first place
Ths fix is simple ... provided one has a copy() library function. Unfortunately
libc doesnt have a simple file copy function, even though it does have a rename().
So, first, write a copy() function and add it to libc.
Then, in files hwconf.c, modules.c, and updfstab.c simply replace the rename()
instances with copy() - except in case of hwconf.c change:
Created attachment 125655 [details]
lrename() function to replace rename()
Here is an lrename() function that should be used instead of rename()
This is a lrename() function which differs from rename() in that it attempt to
follow a destination symbolic link. It is as atomic as rename(). Using this
function instead of rename(P) will ensure that symbolic links are preserved if
possible, on the grounds that people create symbolic links intentionally and
they really want all file reading/writing to go to the symlink target and not
the symlink itself.
Symbolic links should be transparent as far as possible.
This code isn't called any more by default, so it is unlikely this code will be