diff --git a/src/doc/user/usermanual.sgml b/src/doc/user/usermanual.sgml
index 52c8d8b1..a573fd52 100644
--- a/src/doc/user/usermanual.sgml
+++ b/src/doc/user/usermanual.sgml
@@ -24,7 +24,7 @@
Dockes
- $Id: usermanual.sgml,v 1.8 2006-03-30 10:31:03 dockes Exp $
+ $Id: usermanual.sgml,v 1.9 2006-04-04 12:37:51 dockes Exp $
This document introduces full text search notions
@@ -817,9 +817,12 @@
topdirs
- Specifies the list of directories to index
- (recursively).
-
+ Specifies the list of directories or files to
+ index (recursively for directories). The indexer will not
+ follow symbolic links inside the indexed trees. If an entry in
+ the topdirs list is a symbolic link,
+ indexation will not start and will generate an error.
+
skippedNames
diff --git a/src/index/indexer.cpp b/src/index/indexer.cpp
index b66ec25d..46c0ea49 100644
--- a/src/index/indexer.cpp
+++ b/src/index/indexer.cpp
@@ -1,5 +1,5 @@
#ifndef lint
-static char rcsid[] = "@(#$Id: indexer.cpp,v 1.28 2006-04-04 09:34:10 dockes Exp $ (C) 2004 J.F.Dockes";
+static char rcsid[] = "@(#$Id: indexer.cpp,v 1.29 2006-04-04 12:37:51 dockes Exp $ (C) 2004 J.F.Dockes";
#endif
/*
* This program is free software; you can redistribute it and/or modify
@@ -89,8 +89,8 @@ bool DbIndexer::indexDb(bool resetbefore, list *topdirs)
// Walk the directory tree
if (m_walker.walk(*it, *this) != FsTreeWalker::FtwOk) {
- LOGERR(("DbIndexer::index: error while indexing %s\n",
- it->c_str()));
+ LOGERR(("DbIndexer::index: error while indexing %s: %s\n",
+ it->c_str(), m_walker.getReason().c_str()));
return false;
}
}
@@ -267,11 +267,13 @@ bool ConfIndexer::index(bool resetbefore)
string topdirs;
if (!m_config->getConfParam("topdirs", topdirs)) {
LOGERR(("ConfIndexer::index: no top directories in configuration\n"));
+ m_reason = "Top directory list (topdirs param.) not found in config";
return false;
}
list tdl; // List of directories to be indexed
if (!stringToStrings(topdirs, tdl)) {
LOGERR(("ConfIndexer::index: parse error for directory list\n"));
+ m_reason = "Directory list parse error";
return false;
}
@@ -285,10 +287,26 @@ bool ConfIndexer::index(bool resetbefore)
for (dirit = tdl.begin(); dirit != tdl.end(); dirit++) {
string dbdir;
string doctopdir = path_tildexpand(*dirit);
+ { // Check top dirs. Must not be symlinks
+ struct stat st;
+ if (lstat(doctopdir.c_str(), &st) < 0) {
+ LOGERR(("ConfIndexer::index: cant stat %s\n",
+ doctopdir.c_str()));
+ m_reason = string("Stat error for: ") + doctopdir;
+ return false;
+ }
+ if (S_ISLNK(st.st_mode)) {
+ LOGERR(("ConfIndexer::index: no symlinks allowed in topdirs: %s\n",
+ doctopdir.c_str()));
+ m_reason = doctopdir + "is a symbolic link";
+ return false;
+ }
+ }
m_config->setKeyDir(doctopdir);
if (!m_config->getConfParam("dbdir", dbdir)) {
LOGERR(("ConfIndexer::index: no database directory in "
"configuration for %s\n", doctopdir.c_str()));
+ m_reason = string("No database directory set for ") + doctopdir;
return false;
}
dbdir = path_tildexpand(dbdir);
@@ -315,6 +333,7 @@ bool ConfIndexer::index(bool resetbefore)
m_dbindexer = new DbIndexer(m_config, dbit->first, m_updfunc);
if (!m_dbindexer->indexDb(resetbefore, &dbit->second)) {
deleteZ(m_dbindexer);
+ m_reason = string("Failed indexing in ") + dbit->first;
return false;
}
deleteZ(m_dbindexer);
diff --git a/src/index/indexer.h b/src/index/indexer.h
index 0ae6ab67..5f1ced05 100644
--- a/src/index/indexer.h
+++ b/src/index/indexer.h
@@ -16,7 +16,7 @@
*/
#ifndef _INDEXER_H_INCLUDED_
#define _INDEXER_H_INCLUDED_
-/* @(#$Id: indexer.h,v 1.12 2006-04-04 09:34:11 dockes Exp $ (C) 2004 J.F.Dockes */
+/* @(#$Id: indexer.h,v 1.13 2006-04-04 12:37:51 dockes Exp $ (C) 2004 J.F.Dockes */
#include
#include
@@ -53,10 +53,12 @@ class ConfIndexer {
virtual ~ConfIndexer();
/** Worker function: doe the actual indexing */
bool index(bool resetbefore = false);
+ const string &getReason() {return m_reason;}
private:
RclConfig *m_config;
DbIndexer *m_dbindexer; // Object to process directories for a given db
DbIxStatusUpdater *m_updfunc;
+ string m_reason;
};
/** Index things into one database