nALFS - can't remove a broken symlink?

Gerard Beekmans gerard at linuxfromscratch.org
Fri May 16 13:38:12 PDT 2003


I'm using a tag <remove>/bin/vipw</remove> and it doens't work because 
/bin/vipw is a broken symlink.

It so seems <remove> will only delete a symlink if it's a valid one. At first 
I thought maybe it tries to remove the target, but no. It will remove the 
proper file as long as it points at something valid.

Looking at 'stat' man page it seems that it will look to make sure the target 
of a link exists. If lstat were to be used it does the right thing. identical 
to stat in every way except it'll evaluate a link itself rather than its 
target.

So I thought I'd just change 'stat' to 'lstat' in handlers/remove.c, but no 
go. I still get the warning and the broken symlink still doesn't get removed.

Looking close at the code though, when that warning is printed, it doesn't 
seem to abort and just keeps going. So even with that warning "rm -rf" should 
still be run on it. But whatever it does do, it's not removing my files.

Some help would be appreciated.

-- 
Gerard Beekmans
http://linuxfromscratch.org

/* Linux Consultant --- OSDN / DevChannel *
 * Technical Writer --- CheapBytes        */

/* If Linux doesn't have the solution, you have the wrong problem */

-- 
Unsubscribe: send email to listar at linuxfromscratch.org
and put 'unsubscribe alfs-discuss' in the subject header of the message



More information about the alfs-discuss mailing list