From: SourceForge.net <no...@so...> - 2009-03-26 17:24:59
|
Bugs item #745091, was opened at 2003-05-28 19:47 Message generated for change (Comment added) made by mbox You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=390117&aid=745091&group_id=27350 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: genxref Group: None >Status: Closed >Resolution: Wont Fix Priority: 5 Private: No Submitted By: Richard Munroe (munroe_r) Assigned to: Nobody/Anonymous (nobody) Summary: Infinite loop when indexing production source trees. Initial Comment: I generally index my development source trees. When the linux kernel is built, a link from linux to /usr/src/linux is established. Which in many cases causes genxref to go into an infinite loop processing subdirectories. I've patched my version of lxr so that LXR::Files::Plain won't chase directory links (it WILL chase regular file links) which is good enough for my site. Probably a better fix would be to check for links that go outside the currently indexed directory structure and not process stuff that goes outside that or above it in the same directory tree. Anyway, here's the patch: --- /usr/src/lxr-0.9.2/lib/LXR/Files/Plain.pm Tue Feb 26 10:57:55 2002 +++ Plain.pm Wed May 28 14:10:13 2003 @@ -103,6 +103,12 @@ $dir = $self->toreal($pathname, $release); opendir(DIR, $dir) || die ("Can't open $dir"); while (defined($node = readdir(DIR))) { + # + # Avoid chasing links of directories. Using LXR on a production + # source tree results in infinite loops due to the creation + # of a link to linux. + # + next if ((-d "$dir/$node") && (-l "$dir/$node")) ; next if $node =~ /^\.|~$|\.orig$/; next if $node eq 'CVS'; Dick Munroe (mu...@cs...) ---------------------------------------------------------------------- >Comment By: Malcolm Box (mbox) Date: 2009-03-26 17:24 Message: Not chasing links is bad in many environments, so won't apply this globally. Checking for being in the same tree is hard - I think the right approach is to not have source trees which contain circular/infinite loops. ---------------------------------------------------------------------- Comment By: Richard Munroe (munroe_r) Date: 2003-05-29 02:13 Message: Logged In: YES user_id=85781 Here's a better patch, one that doesn't include binary files either: --- /usr/src/lxr-0.9.2/lib/LXR/Files/Plain.pm Tue Feb 26 10:57:55 2002 +++ Plain.pm Wed May 28 21:05:27 2003 @@ -107,10 +107,19 @@ next if $node eq 'CVS'; if (-d $dir.$node) { - push(@dirs, $node.'/'); + # + # Avoid chasing links of directories. Using LXR on a production + # source tree results in infinite loops due to the creation + # of a link to linux. + # + push(@dirs, $node.'/') unless (-l $dir.$node) ; } else { - push(@files, $node); + # + # Binary files aren't of interest to either LXR, so don't put any + # on the list of files returned. + # + push(@files, $node) unless (-B $dir.$node) ; } } closedir(DIR); ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=390117&aid=745091&group_id=27350 |