[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Bug in tidy section
From: |
Bas van der Vlies |
Subject: |
Bug in tidy section |
Date: |
Wed, 18 Sep 2002 10:41:02 +0200 |
cfengine 2.0.4
I want to delete links with the tidy command. I have specified
dirlinks=tidy and links=tidy. But no links will be deleted even
if they point to a non-existent file.
This is from the manual:
The value links=tidy has the same effect as the -L command line option
except that here it may be specified per item rather than globally. Setting
this value causes links which point to non-existent files to be deleted.
This feature will not work on commands with the home wildcard feature. If
you want to clean up old links you should either user a files command or
the command line option which sets the tidy feature globally.
I have done some research in tidy.c function RecursiveTidySpecialArea()
there is check for the owner of a link:
if (S_ISLNK(statbuf.st_mode) && (statbuf.st_mode != getuid()))
{
snprintf(OUTPUT,bufsize,"File %s is an untrusted link. cfagent
will not follow it with a destructive operation (tidy)",pcwd);
continue;
}
}
This statement is wrong. Because we compare the mode bits with getuid
info. it must be:
if (S_ISLNK(statbuf.st_mode) && (statbuf.st_uid != getuid()))
cfagent runs as root so it will only remove links that are own for root.
must this check be skipped for root?. I just want to tidy files under
/tmp or /var/tmp including links.
Another remark must there not be a debug statement included. So we know why a
link is not deleted:
Debug("%s\n", OUTPUT);
--
********************************************************************
* *
* Bas van der Vlies e-mail: address@hidden *
* SARA - Academic Computing Services phone: +31 20 592 8012 *
* Kruislaan 415 fax: +31 20 6683167 *
* 1098 SJ Amsterdam *
* *
********************************************************************
- Bug in tidy section,
Bas van der Vlies <=