Bug 181975 - kudzu unnecessarily destroys configuration symlinks
Summary: kudzu unnecessarily destroys configuration symlinks
Status: CLOSED WONTFIX
Alias: None
Product: Fedora
Classification: Fedora
Component: kudzu   
(Show other bugs)
Version: rawhide
Hardware: All Linux
medium
medium
Target Milestone: ---
Assignee: Bill Nottingham
QA Contact: David Lawrence
URL:
Whiteboard:
Keywords:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2006-02-18 06:45 UTC by JW
Modified: 2014-03-17 02:58 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2008-03-11 03:52:35 UTC
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-05 02:55 UTC, JW
no flags Details

Description JW 2006-02-18 06:45:05 UTC
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-05 02:55:28 UTC
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-11 03:52:35 UTC
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.