Bug 181977 - User/Group changes break symlinked files
User/Group changes break symlinked files
Status: CLOSED RAWHIDE
Product: Fedora
Classification: Fedora
Component: shadow-utils (Show other bugs)
4
All Linux
medium Severity medium
: ---
: ---
Assigned To: Peter Vrabec
David Lawrence
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2006-02-18 02:24 EST by JW
Modified: 2007-11-30 17:11 EST (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2006-03-06 10:30:47 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)
Patch to retain symlinked password database files (1.09 KB, patch)
2006-02-18 02:24 EST, JW
no flags Details | Diff
Better lrename() replacement for rename() (1.45 KB, text/plain)
2006-03-04 21:57 EST, JW
no flags Details

  None (edit)
Description JW 2006-02-18 02:24:39 EST
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):
shadow-utils-4.0.12-6.FC4

How reproducible:
always

Steps to Reproduce:
1.ln -s passwd.xyz passwd
2.useradd ....
3.
  
Actual results:
symlink replaced with plain file
target of symlink unchanged

Expected results:
symlink should remain
symlink target should be written

Additional info:
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.
Comment 1 JW 2006-02-18 02:24:39 EST
Created attachment 124851 [details]
Patch to retain symlinked password database files
Comment 2 JW 2006-03-04 21:57:34 EST
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.

Note You need to log in before you can comment on or make changes to this bug.