Re: finding orphaned files

Carter Sanders <[email protected]> Mon, 21 Jul 2008 14:06:15 -0700
Newsgroups gmane.linux.redhat.rpm.general
Message-ID <[email protected]>
Hi Greg-

    First a question back at you - it seems like your first step 
replicates the --verify option to some extent. Is there some info not 
provided by --verify that you need for step 1?

    About "2:" - I find when I set up the spec file for an rpm, it's 
best to only define %directory that I'm pretty sure won't already exist. 
For example, I would  define it for /opt/mypackage, but not /opt. If you 
have control over the spec files for the rpms you're talking about, you 
could trim these unneeded %directory entries to reduce the orphaned 
directories output from your script.

    Also, I think you'll find that orphaned files are sometimes config 
files, which are retained if they have been edited before rpm removal.

-Carter

[email protected] wrote:
> Hi.
>
> So I'm in the process of writing a script that does a few things:
>
> 1: creates a report of all RPM installed files whose md5 has changed [1]
> 2: creates a report of all non-rpm owned files (orphans)
>
> I've actually got the script working.. First step takes about 9 minutes due
> to the md5 hashing, and the second step takes all of about 15s.  Times
> would be subjective to system, of course.   Anyways.  There is a problem
> with the second report.  Many RPMs report that they own a directory instead
> of a file.  Which isn't a bad thing, except that not all RPMs when removed
> will actually remove the directory and its contents, depending on how it
> was defined as owned.  My original thought was to just check to see if the
> parent directory was owned, but I don't know how conclusive that would be,
> or if it would hide from me some of the files I really need to see.
> Anyone have any suggestions?
>
> -greg
>
>
> [1] I'm using a method similar to this:
> http://people.redhat.com/pnasrat/rpm-python/rpm-python-slides/foil15.html
>
> _______________________________________________
> Rpm-list mailing list
> [email protected]
> https://www.redhat.com/mailman/listinfo/rpm-list
>