Bug 181975 - kudzu unnecessarily destroys configuration symlinks
kudzu unnecessarily destroys configuration symlinks
Status: CLOSED WONTFIX
Product: Fedora
Classification: Fedora
Component: kudzu (Show other bugs)
rawhide
All Linux
medium Severity medium
: ---
: ---
Assigned To: Bill Nottingham
David Lawrence
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2006-02-18 01:45 EST by JW
Modified: 2014-03-16 22:58 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2008-03-10 23:52:35 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
lrename() function to replace rename() (1.45 KB, text/plain)
2006-03-04 21:55 EST, JW
no flags Details

  None (edit)
Description JW 2006-02-18 01:45:05 EST
Description of problem:
When kudzu rewrites configuration files it unncessarily destroys symlinks

Version-Release number of selected component (if applicable):
kudzu-1.1.116.3-1

How reproducible:
always

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
/etc/sysconfig/hwconf
3.kudzu -s
  
Actual results:
Any symlinked config files will become ordinary files

Expected results:
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


Additional info:
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:
    unlink("/etc/inittab");
    rename("/etc/inittab-", "/etc/inittab");
to
    copy("/etc/inittab-", "/etc/inittab");
    unlink("/etc/inittab-");
Comment 1 JW 2006-03-04 21:55:28 EST
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.
Comment 2 Bill Nottingham 2008-03-10 23:52:35 EDT
This code isn't called any more by default, so it is unlikely this code will be
changed.

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