SID-01381: Error: Could not perform search
| Status: |
Answered |
TWiki version: |
5.1.0 |
Perl version: |
v5.10.0 |
| Category: |
CategorySearch |
Server OS: |
Debian 5.0.9 |
Last update: |
13 years ago |
Searching in the TWiki web gives an error:
<pre> Could not perform search. Error was: /bin/grep -F -i -l -H -- %TOKEN|U% %FILES|F% Grep for 'big' returned error </pre>
This is using the URL
/bin/view/TWiki/WebSearch?search=big&scope=all
The error indicates that
grep returned an error, but I'm unable to find what the error is. The only clue is that setting
TRACE to 1 in Sandbox.pm shows a very long command line, and I wonder if it's too long.
Any suggestions as to how I can diagnose this problem would be welcome.
--
KeithEdmunds - 2012-01-17
Discussion and Answer
Examine the apache error log, there might be more details.
I don't think the command line length is the issue, but if you you want to can test that: Reduce the value of
$maxTopicsInSet in
twiki/lib/TWiki/Store/SearchAlgorithms/Forking.pm to a low number, such as 20.
--
PeterThoeny - 2012-01-23
Thanks Peter. Reducing $maxTopicInSet to 20 did not fix this, so you're right about the command length not being a problem.
There's nothing logged to the Apache error log (once I had changed TRACE back to zero).
The error only occurs with the TWiki web; if I change the URL to end 'scope=Main', there is no error.
Appreciate your help: what more can I do to try to understand why this error is occurring?
Thanks -
--
KeithEdmunds - 2012-01-25
Wondering why grep would fail just in the TWiki web. May be a file that causes grep to show an error, such as a broken symlink? Run grep on the TWiki web from the shell, such as:
grep testing data/TWiki/*txt
--
PeterThoeny - 2012-01-25
I've done a grep for 'big' of all files from our TWiki. No errors.
This is puzzling!
--
KeithEdmunds - 2012-01-27
All files below
twiki/data and
twiki/pub owned by webserver user?
--
PeterThoeny - 2012-01-27
Yes:
# pwd
/var/www
# find twiki ! -user www-data
# find twiki ! -group www-data
#
(there was one file owned root:root, which the above commands found, and which I've fixed. The problem persists even after restarting Apache).
--
KeithEdmunds - 2012-01-30
How can I execute the 'grep' command in the same context as TWiki does?
If I can do that, I can probably find the cause of (and thus resolve) this issue.
Thanks.
--
KeithEdmunds - 2012-02-01
Temporarily allow the shell for
www-data user in
/etc/passwd to
/bin/bash, then do a
su www-data. Don't forget to set set the shell back to
/sbin/nologin.
--
PeterThoeny - 2012-02-01
No joy (no need to edit /etc/passwd as the -s switch can be used):
# su -s /bin/bash - www-data
$ cd /var/www/twiki
$ grep -lr big *
[file list omitted]
$ echo $?
0
$
So I don't understand why TWiki's grep is failing.
--
KeithEdmunds - 2012-02-02
Quick update: I just disabled all plugins on the TWiki in question, and the search still fails.
--
KeithEdmunds - 2012-02-02
Peter, I owe you an apology: sorry. There were some files that were not readable by www-data (finger trouble when testing). Thank you very much for your help - Keith.
--
KeithEdmunds - 2012-02-02
I am glad it worked out.
--
PeterThoeny - 2012-02-02
If you answer a question - or someone answered one of your questions - please remember to edit the page and set the status to answered. The status selector is below the edit box.