#113 Search Error in 'feeble attempt to print possible errors'

v0.9.4
closed-fixed
Browsing (93)
5
2005-10-07
2005-10-07
Anonymous
No

I'm running LXR 0.9.4 with Swish-e, MySQL and Plain files.

In the swishsearch function in search, the line

print $hit, "<br>\n" if $hit =~ $hit =~ /No such file
or directory/; # feeble attempt to print possible
errors (e.g. incomplete LD_LIBRARY_PATH causes linking
errors)

doesn't really make sense to me. The conditional "$hit
=~ $hit =~ /No..." can never be TRUE. In fact, worse
than the fact that you can never get TRUE, you can
actually get errors. When $hit had a value of '347
/src/include/g++-3/stl.h "stl.h" 92379' I would get the
following error:

Nested quantifiers in regex; marked by <-- HERE in
m/347 /src/include/g++ <-- HERE -3/stl.h "stl.h" 92379

The ++ in /src/include/g++-3/stl.h causes the grief in
this case. I assumed other invalid rexexps in $hit
would cause similar issues. So I tried $hit = '347
/sdf/sdf/sdf/sdf/[$..---]/ "sdf" 324234' and received:

Invalid [] range ".--" in regex; marked by <-- HERE in
m/347 /sdf/sdf/sdf/sdf/[$..-- <-- HERE -]/ "sdf" 324234

Patch for search 0.9.4

--- search 2005-10-07 14:03:29.000000000 -0400
+++ search.orig 2005-10-07 14:02:00.000000000 -0400
@@ -162,7 +162,7 @@
if ($retval == 0) {
my $numlines = 0;
foreach my $hit (@result) {
- print $hit, "<br>\n" if $hit =~
/No such file or directory/; # feeble attempt to
print possible errors (e.g. incomplete LD_LIBRARY_PATH
causes linking errors)
+ print $hit, "<br>\n" if $hit =~
$hit =~ /No such file or directory/; # feeble
attempt to print possible errors (e.g. incomplete
LD_LIBRARY_PATH causes linking errors)
next if $hit =~ /^err:/; #
skip; only 'no results' errors happen with return value 0

my ($score, $file) = $hit =~
/^(\d+) \/(.+) "(.+)" \d+/;

Discussion

  • Dave Brondsema
    Dave Brondsema
    2005-10-07

    Logged In: YES
    user_id=341298

    Fixed, thanks.

     
  • Dave Brondsema
    Dave Brondsema
    2005-10-07

    • assigned_to: nobody --> brondsem
    • status: open --> closed-fixed