oracle / opengrok

OpenGrok is a fast and usable source code search and cross reference engine, written in Java
http://oracle.github.io/opengrok/
Other
4.3k stars 739 forks source link

issue with new opengrok jumping inside a fortran file to a fortran subroutine - doesn't find symbol #1316

Open ilovemaui opened 7 years ago

ilovemaui commented 7 years ago

this is in opengrok-0.13-rc5

so here is an example. I have a fortran file called foo.f

inside foo.f there is another subroutine in here call foo1 with a definition like this:

subroutine foo1 (a,b,c,d,e,f) when I click on foo1 - it tries to run this: https://myopengrok/source/s?defs=foo1 and it doesn't find it

but if I tried running in a old version of opengrok - 0.9, and I do the same thing, instead of running the above url, it does this instead, and works: https://myopengrok/source/s?refs=foo1

vladak commented 7 years ago

What ctags implementation/version do you use ? Could you post a sample file ?

ilovemaui commented 7 years ago

here is the ctags info: $ ./ctags --version Universal Ctags 0.0.0, Copyright (C) 2015 Universal Ctags Team Universal Ctags is derived from Exuberant Ctags. Exuberant Ctags 5.8, Copyright (C) 1996-2009 Darren Hiebert Compiled: Aug 2 2016, 17:38:54 URL: https://ctags.io/ Optional compiled features: +wildcards, +regex, +option-directory, +coproc

I checked a few files, and there doesn't seem to be any rhyme or reason why some of these work, and some don't. I can look in a fortran .f file with 9 subroutines/functions in it. and 7 of them will try to invoke the new command with s?defs=, and others will use the s?refs= command.

The only other things I see in the logs (in lots of places), and I don't know if it has anything to do with this problem are things like this:

an 05, 2017 8:11:15 AM org.opensolaris.opengrok.analysis.Ctags readTags WARNING: Unexpected end of file! Jan 05, 2017 8:11:15 AM org.opensolaris.opengrok.analysis.Ctags$1 run WARNING: Error from ctags: ctags: Warning: Language "clojure" already defined ctags: Warning: Language "pascal" already defined ctags: Warning: Language "rust" already defined

Jan 05, 2017 8:11:15 AM org.opensolaris.opengrok.analysis.Ctags readTags WARNING: Ctags problem: java.lang.IllegalThreadStateException: process hasn't exited at java.lang.UNIXProcess.exitValue(UNIXProcess.java:424) at org.opensolaris.opengrok.analysis.Ctags.readTags(Ctags.java:383) at org.opensolaris.opengrok.analysis.Ctags.doCtags(Ctags.java:262) at org.opensolaris.opengrok.analysis.plain.PlainAnalyzer.analyze(PlainAnalyzer.java:80) at org.opensolaris.opengrok.analysis.plain.AbstractSourceCodeAnalyzer.analyze(AbstractSourceCodeAnalyzer.java:69) at org.opensolaris.opengrok.analysis.AnalyzerGuru.populateDocument(AnalyzerGuru.java:358) at org.opensolaris.opengrok.index.IndexDatabase.addFile(IndexDatabase.java:622) at org.opensolaris.opengrok.index.IndexDatabase.indexDown(IndexDatabase.java:883) at org.opensolaris.opengrok.index.IndexDatabase.indexDown(IndexDatabase.java:848) at org.opensolaris.opengrok.index.IndexDatabase.indexDown(IndexDatabase.java:848) at org.opensolaris.opengrok.index.IndexDatabase.indexDown(IndexDatabase.java:848) at org.opensolaris.opengrok.index.IndexDatabase.indexDown(IndexDatabase.java:848) at org.opensolaris.opengrok.index.IndexDatabase.indexDown(IndexDatabase.java:848) at org.opensolaris.opengrok.index.IndexDatabase.update(IndexDatabase.java:397) at org.opensolaris.opengrok.index.IndexDatabase$2.run(IndexDatabase.java:184) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745)

tulinkry commented 7 years ago

I'm trying but I can't reproduce it. If you could post the faulty file (truncated, censored, without unneccessary code) which would reproduce the problem, that would be fine.

Refs get generated when it's probably the definition of the symbol. Defs get generated when the symbol is not a definition and has occurred more than once in that file.

ilovemaui commented 7 years ago

So I looked at this again, and I can find no rhyme or reason why this occurs. It's random throughout our code base. I was looking at a fortran file (that had around 15 subroutines), and 2 of the files could be reference via the definition (and those subroutines were highlighted in opengrok in a dark blue color), where the other files had no special color. I can't seem to find any pattern that might speak to this. Any ideas?

vladak commented 7 years ago

The way I deal with such problems is I try to isolate the problem as far as I can by making the file smaller and smaller and reindex each time to see if the problem is still there. Once I arrive to minimal reproducible case then redact the file and post it. At least this is what I did when we encountered bugs in Universal ctags.

vladak commented 7 years ago

You should definitely try to run latest greatest Universal ctags binary on the files to see what set of definitions are produced. OpenGrok gets the function definitions from Universal ctags.

ilovemaui commented 7 years ago

thanks, i will try pulling down the latest version of universal-ctags, and see if it is fixed in there.

vladak commented 7 years ago

@ilovemaui any news ?

ilovemaui commented 7 years ago

I am not sure if this is still broken. I plan to build the latest version of OpenGrok soon, so can see if all of these issues are fixed there.

vladak commented 7 years ago

Here the key is to try the latest universal-ctags, OpenGrok changes will not help there I believe.

ilovemaui commented 7 years ago

ok. will let you know. will try to test in the next couple of weeks.