check for empty file name in internfile, else gets stuck later because empty fn is interpreted as read stdin in md5
This commit is contained in:
parent
4dfbc52c6c
commit
1329265b7b
@ -3,7 +3,14 @@
|
|||||||
# This is a shell script that starts and stops the recollindex daemon
|
# This is a shell script that starts and stops the recollindex daemon
|
||||||
# depending on whether or not the power supply is plugged in. It should be
|
# depending on whether or not the power supply is plugged in. It should be
|
||||||
# called from the file ~/.config/autostart/recollindex.desktop.
|
# called from the file ~/.config/autostart/recollindex.desktop.
|
||||||
|
#
|
||||||
|
# That is: make the script executable (chmod +x) and replace in
|
||||||
|
# recollindex.desk the line:
|
||||||
|
# Exec=recollindex -w 60 -m
|
||||||
|
# With
|
||||||
|
# Exec=/path/to/recoll_index_on_ac.sh
|
||||||
|
#
|
||||||
|
#
|
||||||
# By: The Doctor (drwho at virtadpt dot net)
|
# By: The Doctor (drwho at virtadpt dot net)
|
||||||
# License: GPLv3
|
# License: GPLv3
|
||||||
#
|
#
|
||||||
|
|||||||
@ -2489,15 +2489,40 @@ text/html [file:///Users/uncrypted-dockes/projets/bateaux/ilur/factEtCie/r
|
|||||||
<listitem><para><literal>dir</literal> for filtering the
|
<listitem><para><literal>dir</literal> for filtering the
|
||||||
results on file location (Ex:
|
results on file location (Ex:
|
||||||
<literal>dir:/home/me/somedir</literal>). <literal>-dir</literal>
|
<literal>dir:/home/me/somedir</literal>). <literal>-dir</literal>
|
||||||
also works to find results out of the specified directory, only
|
also works to find results not in the specified directory
|
||||||
after release 1.15.8. A tilde inside the value will be expanded to
|
(release >= 1.15.8). A tilde inside the value will be expanded
|
||||||
the home directory. <literal>dir</literal> is not a regular field
|
to the home directory. Wildcards will <emphasis>not</emphasis>
|
||||||
and only one value makes sense in a query (you can't use
|
be expanded. You cannot use <literal>OR</literal> with
|
||||||
<literal>dir:dir1 OR dir:dir2</literal>). Relative paths make
|
<literal>dir</literal> clauses (this restriction may go away in
|
||||||
sense, for example,
|
the future).</para>
|
||||||
|
|
||||||
|
<para>Relative paths also make sense, for example,
|
||||||
<literal>dir:share/doc</literal> would match either
|
<literal>dir:share/doc</literal> would match either
|
||||||
<filename>/usr/share/doc</filename> or
|
<filename>/usr/share/doc</filename> or
|
||||||
<filename>/usr/local/share/doc</filename> </para>
|
<filename>/usr/local/share/doc</filename> </para>
|
||||||
|
|
||||||
|
<para>Several <literal>dir</literal> clauses can be specified,
|
||||||
|
both positive and negative. For example the following makes sense:
|
||||||
|
<programlisting>
|
||||||
|
dir:recoll dir:src -dir:utils -dir:common
|
||||||
|
</programlisting> This would select results which have both
|
||||||
|
<filename>recoll</filename> and <filename>src</filename> in the
|
||||||
|
path (in any order), and which have not either
|
||||||
|
<filename>utils</filename> or
|
||||||
|
<filename>common</filename>.</para>
|
||||||
|
|
||||||
|
<para>Another special aspect of <literal>dir</literal> clauses is
|
||||||
|
that the values in the index are not transcoded to UTF-8, and
|
||||||
|
never lower-cased or unaccented, but stored as binary. This means
|
||||||
|
that you need to enter the values in the exact lower or upper
|
||||||
|
case, and that searches for names with diacritics may sometimes
|
||||||
|
be impossible because of character set conversion
|
||||||
|
issues. Non-ASCII UNIX file paths are an unending source of
|
||||||
|
trouble and are best avoided.</para>
|
||||||
|
|
||||||
|
<para>You need to use double-quotes around the path value if it
|
||||||
|
contains space characters.</para>
|
||||||
|
|
||||||
</listitem>
|
</listitem>
|
||||||
|
|
||||||
<listitem><para><literal>size</literal> for filtering the
|
<listitem><para><literal>size</literal> for filtering the
|
||||||
|
|||||||
@ -187,18 +187,27 @@ void FileInterner::tmpcleanup()
|
|||||||
// Empty handler on return says that we're in error, this will be
|
// Empty handler on return says that we're in error, this will be
|
||||||
// processed by the first call to internfile().
|
// processed by the first call to internfile().
|
||||||
// Split into "constructor calls init()" to allow use from other constructor
|
// Split into "constructor calls init()" to allow use from other constructor
|
||||||
FileInterner::FileInterner(const string &f, const struct stat *stp,
|
FileInterner::FileInterner(const string &fn, const struct stat *stp,
|
||||||
RclConfig *cnf,
|
RclConfig *cnf,
|
||||||
TempDir& td, int flags, const string *imime)
|
TempDir& td, int flags, const string *imime)
|
||||||
: m_tdir(td), m_ok(false), m_missingdatap(0)
|
: m_tdir(td), m_ok(false), m_missingdatap(0)
|
||||||
{
|
{
|
||||||
|
LOGDEB0(("FileInterner::FileInterner(fn=%s)\n", fn.c_str()));
|
||||||
|
if (fn.empty()) {
|
||||||
|
LOGERR(("FileInterner::FileInterner: empty file name!\n"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
initcommon(cnf, flags);
|
initcommon(cnf, flags);
|
||||||
init(f, stp, cnf, flags, imime);
|
init(fn, stp, cnf, flags, imime);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileInterner::init(const string &f, const struct stat *stp, RclConfig *cnf,
|
void FileInterner::init(const string &f, const struct stat *stp, RclConfig *cnf,
|
||||||
int flags, const string *imime)
|
int flags, const string *imime)
|
||||||
{
|
{
|
||||||
|
if (f.empty()) {
|
||||||
|
LOGERR(("FileInterner::init: empty file name!\n"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
m_fn = f;
|
m_fn = f;
|
||||||
|
|
||||||
// Compute udi for the input file. This is used by filters which
|
// Compute udi for the input file. This is used by filters which
|
||||||
@ -226,7 +235,7 @@ void FileInterner::init(const string &f, const struct stat *stp, RclConfig *cnf,
|
|||||||
}
|
}
|
||||||
l_mime = *imime;
|
l_mime = *imime;
|
||||||
} else {
|
} else {
|
||||||
LOGDEB(("FileInterner:: [%s] mime [%s] preview %d\n",
|
LOGDEB(("FileInterner::init fn [%s] mime [%s] preview %d\n",
|
||||||
f.c_str(), imime?imime->c_str() : "(null)", m_forPreview));
|
f.c_str(), imime?imime->c_str() : "(null)", m_forPreview));
|
||||||
|
|
||||||
// Run mime type identification in any case (see comment above).
|
// Run mime type identification in any case (see comment above).
|
||||||
@ -320,6 +329,7 @@ FileInterner::FileInterner(const string &data, RclConfig *cnf,
|
|||||||
TempDir& td, int flags, const string& imime)
|
TempDir& td, int flags, const string& imime)
|
||||||
: m_tdir(td), m_ok(false), m_missingdatap(0)
|
: m_tdir(td), m_ok(false), m_missingdatap(0)
|
||||||
{
|
{
|
||||||
|
LOGDEB0(("FileInterner::FileInterner(data)\n"));
|
||||||
initcommon(cnf, flags);
|
initcommon(cnf, flags);
|
||||||
init(data, cnf, flags, imime);
|
init(data, cnf, flags, imime);
|
||||||
}
|
}
|
||||||
@ -384,7 +394,7 @@ FileInterner::FileInterner(const Rcl::Doc& idoc, RclConfig *cnf,
|
|||||||
TempDir& td, int flags)
|
TempDir& td, int flags)
|
||||||
: m_tdir(td), m_ok(false), m_missingdatap(0)
|
: m_tdir(td), m_ok(false), m_missingdatap(0)
|
||||||
{
|
{
|
||||||
LOGDEB(("FileInterner::FileInterner(idoc)\n"));
|
LOGDEB0(("FileInterner::FileInterner(idoc)\n"));
|
||||||
initcommon(cnf, flags);
|
initcommon(cnf, flags);
|
||||||
|
|
||||||
DocFetcher *fetcher = docFetcherMake(idoc);
|
DocFetcher *fetcher = docFetcherMake(idoc);
|
||||||
|
|||||||
@ -368,7 +368,7 @@ bool SearchData::toNativeQuery(Rcl::Db &db, void *d, int maxexp, int maxcl)
|
|||||||
xq = xq.empty() ? tq : Xapian::Query(Xapian::Query::OP_AND_NOT, xq, tq);
|
xq = xq.empty() ? tq : Xapian::Query(Xapian::Query::OP_AND_NOT, xq, tq);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add the directory filtering clause. This is a phrase of terms
|
// Add the directory filtering clauses. Each is a phrase of terms
|
||||||
// prefixed with the pathelt prefix XP
|
// prefixed with the pathelt prefix XP
|
||||||
for (vector<DirSpec>::const_iterator dit = m_dirspecs.begin();
|
for (vector<DirSpec>::const_iterator dit = m_dirspecs.begin();
|
||||||
dit != m_dirspecs.end(); dit++) {
|
dit != m_dirspecs.end(); dit++) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user