updatedb currently uses getmntent(3) to retrieve the list of mounted filesystems. This library function is not standardized and not available on all systems. Here is a patch to use the gnulib mountlist module instead.
The mountlist module does not provide access to the mount flags, making it impossible to prune bind mounts. Therefore it is only used if getmntent(3) is not available. Note that there is usually no support for mount --bind on non-linux systems anyway.
mount --bind
This patch has successfully been tested on: * Mac OS X 10.6.2 * Debian Linux 5.0.4 (lenny)
attachment mlocate-mountlist-hg.diff
Thanks for the patch. It probably needs more testing - AFAICS it does:
{{{ me = read_file_system_list(true); while (me != NULL) .... }}}
without ever advancing "me".
me
Also, I wonder if the result would be cleaner if all #ifdefs were concentrated near callers.
#ifdef
Perhaps {{{
}}} ... definitions for bind mounts
{{{
}}} ... and so on...
}}}
or use static functions for the alternatives, or perhaps push the #ifdefs inside functions. In any case, so many #ifdefs in callers should not be needed.
Replying to [comment:1 mitr]:
Thanks for the patch. It probably needs more testing - AFAICS it does: {{{ me = read_file_system_list(true); while (me != NULL) .... }}} without ever advancing "me".
Oops, that is a mistake. Sorry, probably the line got lost in final reformatting of the code. Will attach a revised patch.
Also, I wonder if the result would be cleaner if all #ifdefs were concentrated near callers. ... or use static functions for the alternatives, or perhaps push the #ifdefs inside functions. In any case, so many #ifdefs in callers should not be needed.
Alright. filesystem_is_excluded() could also be converted to use gnulib only, although I wanted to be least intrusive to the existing code. The difference would be that gnulib mountlist always relies on _PATH_MOUNTED and does not use mount info from /proc.
Also I noticed that the memory allocated by read_file_system_list() needs to be released after use.
Revised patch with mount_entry pointer advance mlocate-mountlist-hg.2.diff
I'm sorry about the terribly late response
Replying to [comment:2 raimue]:
Replying to [comment:1 mitr]: Alright. filesystem_is_excluded() could also be converted to use gnulib only, although I wanted to be least intrusive to the existing code. The difference would be that gnulib mountlist always relies on _PATH_MOUNTED and does not use mount info from /proc. Right, using /proc is actually important (as mentioned in the comment about NFS). Also I noticed that the memory allocated by read_file_system_list() needs to be released after use. It does need to be released. Care to update the patch?
Replying to [comment:1 mitr]: Alright. filesystem_is_excluded() could also be converted to use gnulib only, although I wanted to be least intrusive to the existing code. The difference would be that gnulib mountlist always relies on _PATH_MOUNTED and does not use mount info from /proc. Right, using /proc is actually important (as mentioned in the comment about NFS).
Also I noticed that the memory allocated by read_file_system_list() needs to be released after use. It does need to be released. Care to update the patch?
The attachments for this issue (#15) seem to be missing - the links just lead to 404 error pages. I realize they are old and need more work; but are they available anywhere?
Thank you.
I don’t have any other copy I’m afraid.
It might be possible to get them from backups per https://fedoraproject.org/wiki/Infrastructure/Fedorahosted-retirement .
Metadata Update from @mitr: - Issue close_status updated to: None
Sorry that I never continued the work on this patch, but my focus shifted elsewhere.
I do not seem to have the originally submitted patch any more, but after some digging in the backups I found a mercurial checkout that still has this change. I am attaching an export of the changesets.
<img alt="mlocate-mountlist-hg-recovered.diff" src="/mlocate/issue/raw/files/efc0204403339a9e969484ad34e3ad305fc84d0c0564ad739fb8a9e623f2422e-mlocate-mountlist-hg-recovered.diff" />
Sorry that I never continued the work on this patch, but my focus shifted elsewhere. I do not seem to have the originally submitted patch any more, but after some digging in the backups I found a mercurial checkout that still has this change. I am attaching an export of the changesets.
Thank you very much for digging that up!
Login to comment on this ticket.