nALFS - can't remove a broken symlink?

Neven Has haski at sezampro.yu
Sat May 17 07:47:28 PDT 2003


On Fri, May 16, 2003 at 02:38:12PM -0600, Gerard Beekmans wrote:
> 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.

That check for file existence is new 1.1.7 and is obviously a mistake.
You also can't use wildcards in <remove> anymore (again, because stat
fails).

It's removed already, so for the next version, it will be a simple
"rm -fr whatever_is_in_remove" again.

> 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.

Executing keeps going, but "rm -rf" is executed only if file does
exist.  So if warning is printed (which should mean that the file
doesn't exist) "rm -rf" is not executed.

But as I said, that check is now gone, it's just pointless and
unnecessarily complicated.

As for the remove.c, it's the handler for syntax version 2.0
(see handler_syntax_versions variable in all handlers).


Neven

-- 
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