Bug 181977 - User/Group changes break symlinked files
Summary: User/Group changes break symlinked files
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: shadow-utils
Version: 4
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Peter Vrabec
QA Contact: David Lawrence
URL:
Whiteboard:
Keywords:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2006-02-18 07:24 UTC by JW
Modified: 2007-11-30 22:11 UTC (History)
0 users

(edit)
Clone Of:
(edit)
Last Closed: 2006-03-06 15:30:47 UTC


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

Description JW 2006-02-18 07:24:39 UTC
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 07:24:39 UTC
Created attachment 124851 [details]
Patch to retain symlinked password database files

Comment 2 JW 2006-03-05 02:57:34 UTC
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.