Description of problem:
If any of the user database files are symlinks (which they might be if one has a
sophisticated DVD based system containing multiple pre-defined files to suit
multiple sites) then updates will destroy the symbolic link and replace it with
a plain file rather than alter the file which the symbolic link points to.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1.ln -s passwd.xyz passwd
symlink replaced with plain file
target of symlink unchanged
symlink should remain
symlink target should be written
This arises because of broken rename() libc function which never follows a
destination symbolic link. And there isn't a handy lrename() which does follow
destination symbolic link. Worse still, there isn't even a simple copy() libc
function to perform a file copy.
Created attachment 124851 [details]
Patch to retain symlinked password database files
Created attachment 125656 [details]
Better lrename() replacement for 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.