This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 269098

Summary: [newcodemodel] False 'cannot find include file' and related 'unable to resolve indentifier'
Product: cnd Reporter: InfoGeek
Component: Code ModelAssignee: Vladimir Voskresensky <vv159170>
Status: STARTED ---    
Severity: normal CC: AE56, InfoGeek
Priority: P3 Keywords: NO82
Version: 8.2   
Hardware: PC   
OS: Linux   
Issue Type: DEFECT Exception Reporter:
Attachments: C/C++ Diagnostics log
Main file where include directory is marked as error.
Full test case for the errors
Test project using the Full test case.
Expected test results/errors
IDE "Help->About" Dialog
Log after removing entire "/root/.netbeans" directory and loading MyApp project.
Launched IDE with cleaned user dir and /root/tmp as ".tmpdir=" parameter

Description InfoGeek 2016-11-23 23:19:37 UTC
--- SETUP ---

My library is located at: "/root/MNT_Programming_C++_Linux/My Library"

I include a simple file like so:

#include "My Library/files/SuperFile.h"

and add the path to include paths of the project: "/root/MNT_Programming_C++_Linux/"

--- PROBLEM ---

Netbeans reports false errors(underlines in red, does not show related identifier methods/variables, restricts file opening through editor to the falsely reported include failure etc.) when I try to include a directory with my library declarations, but it builds OK and gives no output errors on the output window.

Also note that all standard includes like <stdlib.h> etc work perfectly fine.

--- ONLY WORKING CASE ---

However, if I create the project("MyProject") specifically inside the library project directory ("/root/MNT_Programming_C++_Linux/My Library/MyProject") and repeat the same thing, code assistance works, no errors are marked, navigation and completion also works, everything.

--- TRIED ---

I have tried everything:
*) Clean IDE-cache.
*) Re-parse project.
*) Re-create main.cpp.
*) Enable 777 permissions on everything.
*) Clicking almost all imaginable Reset to defaults buttons.

I'm absolutely lost and even thought of switching because this pollutes the file with false errors. The only potentially useful hint I can give it that when in the [ONLY WORKING CASE] you CTRL+hover over the include path it says "Library File /root/MNT_Programming_C++_Linux/My Library/files/SuperFile.h" as if implying that it used some magic to detect and work just because it happens to be a file of a library whereas if you create the project anywhere else it doesn't do the magic. This is just speculation though.
Comment 1 Vladimir Voskresensky 2016-11-24 12:23:10 UTC
Could you, please, rename your "My Library" folder to something without space in path? I.e. "My_Library" project? and then change 
#include "My Library/files/SuperFile.h"
to
#include "My_Library/files/SuperFile.h"
Comment 2 Vladimir Voskresensky 2016-11-24 12:24:08 UTC
(In reply to Vladimir Voskresensky from comment #1)
> Could you, please, rename your "My Library" folder to something without
> space in path? I.e. "My_Library" project? 
It is not recommended to use paths with spaces for #include directives
Comment 3 InfoGeek 2016-11-24 17:28:24 UTC
(In reply to Vladimir Voskresensky from comment #2)
> (In reply to Vladimir Voskresensky from comment #1)
> > Could you, please, rename your "My Library" folder to something without
> > space in path? I.e. "My_Library" project? 
> It is not recommended to use paths with spaces for #include directives

I am sorry, I forgot to mention that my library is actually:

Project - "/root/MNT_Programming_C++_Linux/My Library" , but it points to all headers from: "/root/MNT_Programming_C++_Linux/My" so there's no space at the point of include paths(there would be with library paths, because binaries are created in the project but I am not even doing this step as it is irrelevant to include paths).
Comment 4 InfoGeek 2016-11-24 17:30:48 UTC
So I am actually doing:

#include "My/files/SuperFile.h"

in the code, many apologies for the disinformation (I would edit the first post but I don't see an option to).
Comment 5 Vladimir Voskresensky 2016-11-25 11:58:32 UTC
Could you, please, open the file where you have unresolved directive, then (when cursor is in file) press Ctrl+Alt+Shift+M and select "Preprocessor States", then OK. In the Output you will see some logging.
Please, attach log file (mentioned in the first line of log) here. 

Thanks,
Vladimir.
Comment 6 InfoGeek 2016-11-25 13:03:27 UTC
Created attachment 163023 [details]
C/C++ Diagnostics log
Comment 7 InfoGeek 2016-11-25 13:04:27 UTC
Created attachment 163024 [details]
Main file where include directory is marked as error.
Comment 8 Vladimir Voskresensky 2016-11-25 13:14:48 UTC
could you, please, provide output in shell
#ls /root/MNT_Programming_C++_Linux
Comment 9 InfoGeek 2016-11-25 13:25:30 UTC
Output of ls on it is as expected:

--------OUTPUT START--------------
My My Library
--------OUTPUT END--------------

Those are two directories:

"My" containing the include files.
"My Library" project to build the library(pointing to My... interestingly enough all includes included in a similar fashion "My/something/someFile.h" for the library project also are not marked as errors and work well).
Comment 10 InfoGeek 2016-11-25 13:35:02 UTC
Partially disregard my last comment about library files not marking as errors includes of header files... because they don't refer to the full paths such as  "My/something/someFile.h" but all of them include just "someFile.h" and each include path is added per each respective file in project includes, such as "My/something/" for "someFile.h". Sorry, I'm probably polluting the debug process more than helping.
Comment 11 Vladimir Voskresensky 2016-11-25 16:53:13 UTC
could you, please, provide 
#find .
Comment 12 InfoGeek 2016-11-25 18:11:41 UTC
Output from "find ." :

--------OUTPUT START--------------
.
./My
./My/file
./My/file/MegaFile.cpp
./My/file/MegaFile.h
./My/file/UltraFile.cpp
./My/file/UltraFile.h
./My/files
./My/files/SuperFile.cpp
./My/files/SuperFile.h
./My/math
./My/math/Degrees.h
./My/net
./My/net/SonicSockets
./My/net/SonicSockets/SonicSocket.cpp
./My/net/SonicSockets/SonicSocket.h
./My Library
./My Library/.dep.inc
./My Library/build
./My Library/build/Debug
./My Library/build/Debug/GNU-Linux
./My Library/build/Debug/GNU-Linux/_ext
./My Library/build/Debug/GNU-Linux/_ext/365e969a
./My Library/build/Debug/GNU-Linux/_ext/365e969a/SonicSocket.o
./My Library/build/Debug/GNU-Linux/_ext/365e969a/SonicSocket.o.d
./My Library/build/Debug/GNU-Linux/_ext/51bdf150
./My Library/build/Debug/GNU-Linux/_ext/51bdf150/MegaFile.o
./My Library/build/Debug/GNU-Linux/_ext/51bdf150/MegaFile.o.d
./My Library/build/Debug/GNU-Linux/_ext/51bdf150/UltraFile.o
./My Library/build/Debug/GNU-Linux/_ext/51bdf150/UltraFile.o.d
./My Library/build/Debug/GNU-Linux/_ext/e6003923
./My Library/build/Debug/GNU-Linux/_ext/e6003923/SuperFile.o
./My Library/build/Debug/GNU-Linux/_ext/e6003923/SuperFile.o.d
./My Library/Makefile
./My Library/nbproject
./My Library/nbproject/configurations.xml
./My Library/nbproject/Makefile-Debug.mk
./My Library/nbproject/Makefile-impl.mk
./My Library/nbproject/Makefile-Release.mk
./My Library/nbproject/Makefile-variables.mk
./My Library/nbproject/Package-Debug.bash
./My Library/nbproject/Package-Release.bash
./My Library/nbproject/private
./My Library/nbproject/private/configurations.xml
./My Library/nbproject/private/cpp_standard_headers_indexer.cpp
./My Library/nbproject/private/c_standard_headers_indexer.c
./My Library/nbproject/private/launcher.properties
./My Library/nbproject/private/Makefile-variables.mk
./My Library/nbproject/private/private.xml
./My Library/nbproject/project.xml
--------OUTPUT END--------------
Comment 13 Vladimir Voskresensky 2016-11-28 08:46:35 UTC
Could you, please, share your project with me for analysis?
You can clean up sources, if you'd like. But I need a reproducible test case.
I will create your file system layout in my env to see the problem.

Thanks!
Vladimir.
Comment 14 InfoGeek 2016-11-28 09:48:30 UTC
Created attachment 163049 [details]
Full test case for the errors
Comment 15 InfoGeek 2016-11-28 09:54:49 UTC
I have attached a zipped directory containing everything described(I've re-created it for a minimal test case).

This directory "Mounted Directory" is actually an SVN directory on Windows that I mount on my VirtualBox Debian 8.6(jessie) x64 as "/root/SVN_Programming_C++_Linux" (but it should all be irrelevant since it just mounts on linux guest OS).

I forgot to include the minimal test app project that is under "/root/test/MyApp".

The next upload is going to be it.
Comment 16 InfoGeek 2016-11-28 09:56:27 UTC
Created attachment 163050 [details]
Test project using the Full test case.
Comment 17 InfoGeek 2016-11-28 12:52:07 UTC
Created attachment 163052 [details]
Expected test results/errors
Comment 18 Vladimir Voskresensky 2016-11-28 13:42:12 UTC
Thanks a lot for sharing a test case. Could you, please, insert here 
Help->About content

Thanks!
Comment 19 InfoGeek 2016-11-28 13:49:07 UTC
Created attachment 163053 [details]
IDE "Help->About" Dialog
Comment 20 Vladimir Voskresensky 2016-11-28 14:26:24 UTC
I can not reproduce the problem. Everything is resolved correctly on my system.
Could you, please, start IDE with clean userdir and send me your message.log, please, when you see unresolved includes.
http://wiki.netbeans.org/FaqWhatIsUserdir
http://wiki.netbeans.org/FaqLogMessagesFile

Thanks!
Comment 21 Vladimir Voskresensky 2016-11-28 14:30:48 UTC
Also, please, add extra logging to be placed into message.log by starting IDE with
-J-Dorg.netbeans.modules.cnd.apt.level=ALL

Thanks
Comment 22 InfoGeek 2016-11-28 14:55:59 UTC
Created attachment 163054 [details]
Log after removing entire "/root/.netbeans" directory and loading MyApp project.
Comment 23 Vladimir Voskresensky 2016-11-28 15:13:09 UTC
Thanks for the log. Still no clue...

Could you, please, check that the problem is really not with your virtual env.
For instance, copy your /root/test and /root/SVN_Programming_C++_Linux to some other place (i.e. into /var/tmp/root/) and try to open and compile from there.
Comment 24 InfoGeek 2016-11-28 15:56:35 UTC
(In reply to Vladimir Voskresensky from comment #23)
> Thanks for the log. Still no clue...
> 
> Could you, please, check that the problem is really not with your virtual
> env.
> For instance, copy your /root/test and /root/SVN_Programming_C++_Linux to
> some other place (i.e. into /var/tmp/root/) and try to open and compile from
> there.

If I place the "My" directory (with .h files) in "/var/tmp/root/" and point to it, it works just fine and parses correctly in the editor. As soon as I point back to "/root/SVN_Programming_C++_Linux/" where the same "My" directory resides, it complains.
Comment 25 Vladimir Voskresensky 2016-11-28 16:10:51 UTC
Great!
So, I think the reason could be in the different case-sensitivity of the mounted file system (which is from Windows, so it is case insensitive) and 'usual' case-sensitive Linux file system... So, we have a mix and it cause the problem...
Comment 26 Vladimir Voskresensky 2016-11-28 16:22:31 UTC
Let's try the following:
- create "tmp" folder in your "/root" folder.

Then start IDE with clean userdir and -J-Djava.io.tmpdir=/root/tmp
Comment 27 InfoGeek 2016-11-28 16:37:48 UTC
Created attachment 163056 [details]
Launched IDE with cleaned user dir and /root/tmp as ".tmpdir=" parameter
Comment 28 InfoGeek 2016-11-28 16:42:53 UTC
(In reply to Vladimir Voskresensky from comment #26)
> Let's try the following:
> - create "tmp" folder in your "/root" folder.
> 
> Then start IDE with clean userdir and -J-Djava.io.tmpdir=/root/tmp

Still the same behaviour. pointing to "/var/tmp/root" works, the other "/root/SVN..." doesn't. The log seems to say that the parameter passing worked though? Not sure if it did what you wanted it to do.


I don't really understand... You share/map whatever windows folder to a share name "Some_Share_Name" and you mount int in /etc/fstab :
---------------------------------
Some_Share_Name /root/somePath vboxsf defaults 0 0
---------------------------------

Where would the case sensitivity come into play?

It does seem like something is with the mounting... because I also tried a simple directory with "+" signs in it and it was fine. Then I tried mounting the same windows dir to "/var/tmp/poop" and it fails the same as "/root/SVN..." so I'm lost here.
Comment 29 Vladimir Voskresensky 2016-11-28 18:40:14 UTC
(In reply to InfoGeek from comment #28)
> (In reply to Vladimir Voskresensky from comment #26)
> > Let's try the following:
> > - create "tmp" folder in your "/root" folder.
> > 
> > Then start IDE with clean userdir and -J-Djava.io.tmpdir=/root/tmp
> 
> Still the same behaviour. pointing to "/var/tmp/root" works, the other
> "/root/SVN..." doesn't. The log seems to say that the parameter passing
> worked though? Not sure if it did what you wanted it to do.
> 
> 
> I don't really understand... You share/map whatever windows folder to a
> share name "Some_Share_Name" and you mount int in /etc/fstab :
> ---------------------------------
> Some_Share_Name /root/somePath vboxsf defaults 0 0
> ---------------------------------
> 
> Where would the case sensitivity come into play?
All Linux native FS are case sensitive by default (so you can create easily two files: FileName and filename in the same folder)
Windows folder mapped in the Linux env are in fact "windows FS", so you can not create 'FileName' and 'filename' in the same folder. This is where case sensitivity come into play. 
Although I really don't understand why it fails to resolve...
I will add extra flag to force case sensitivity of the IDE. And we'll see if it helps

> 
> It does seem like something is with the mounting... because I also tried a
> simple directory with "+" signs in it and it was fine. Then I tried mounting
> the same windows dir to "/var/tmp/poop" and it fails the same as
> "/root/SVN..." so I'm lost here.
Comment 30 Vladimir Voskresensky 2016-11-28 18:45:22 UTC
One more experiment.

Could you run the IDE with clean userdir and extra flags

-J-Dos.name="Windows Vista" -J-Djava.io.tmpdir=/root/tmp

make sure in advance that /root/tmp is existing folder on your mounted path
Comment 31 InfoGeek 2016-11-28 18:54:15 UTC
(In reply to Vladimir Voskresensky from comment #30)
> One more experiment.
> 
> Could you run the IDE with clean userdir and extra flags
> 
> -J-Dos.name="Windows Vista" -J-Djava.io.tmpdir=/root/tmp
> 
> make sure in advance that /root/tmp is existing folder on your mounted path

I'm sorry, I'm not sure here. What should I do when I start with these parameters? Should the windows folder be re-mounter under "/root/tmp" or is it just a directory for IDE? Should I be placing something in it?
Comment 32 Vladimir Voskresensky 2016-11-28 19:22:13 UTC
(In reply to InfoGeek from comment #31)
> (In reply to Vladimir Voskresensky from comment #30)
> > One more experiment.
> > 
> > Could you run the IDE with clean userdir and extra flags
> > 
> > -J-Dos.name="Windows Vista" -J-Djava.io.tmpdir=/root/tmp
> > 
> > make sure in advance that /root/tmp is existing folder on your mounted path
> 
> I'm sorry, I'm not sure here. What should I do when I start with these
> parameters? Should the windows folder be re-mounter under "/root/tmp" or is
> it just a directory for IDE? Should I be placing something in it?
Once you said, that you use "/root/somePath" folder to mount in the virtual Linux the folder from Windows.
After that I expect that inside /root/somePath on Linux you will see the content of Window's folder, right?
What I'm asking for is:
- when you in Linux, create "tmp" folder inside your /root/somePath (i.e. /root/somePath/tmp). I've asked you to make sure that "tmp" folder for the IDE is inside the mounted path on Linux
- use that path to run IDE with clean userdir and redirected tmp dir: 
-J-Djava.io.tmpdir=/root/somePath/tmp
Comment 33 Vladimir Voskresensky 2016-11-28 19:23:42 UTC
added some logging and param -J-Dcnd.case.sensitive.fs=true to control case sensitivity
 changeset: 313465:cf8922bf122d [release82]
Comment 34 InfoGeek 2016-11-28 19:49:21 UTC
That was just an example.

I'm mounting my windows folder to "/root/SVN_Programming_C++_Linux".

I have tried passing the parameter to set temporary folder on:
1) "/root/SVN_Programming_C++_Linux"
2) "/root/SVN_Programming_C++_Linux/tmp"

as you just told me to; using my "/root/test/MyApp" to point to "/root/SVN_Programming_C++_Linux"... nothing works.

And the -J-Dos.name="Windows Vista" flag doesn't work(Exception in Thread "main" java.lang.AssertionError: Platform not Recognized) as well as its variations "Windows 7" or "Windows7".
Comment 35 Vladimir Voskresensky 2016-11-28 21:43:01 UTC
could you try the following flag:
-J-Dapt.use.clank=false
Comment 36 InfoGeek 2016-11-28 22:06:09 UTC
(In reply to Vladimir Voskresensky from comment #35)
> could you try the following flag:
> -J-Dapt.use.clank=false

THAT DID IT!!!

What magic did you use and what does that mean?
Comment 37 Vladimir Voskresensky 2016-11-29 13:09:45 UTC
(In reply to InfoGeek from comment #36)
> (In reply to Vladimir Voskresensky from comment #35)
> > could you try the following flag:
> > -J-Dapt.use.clank=false
> 
> THAT DID IT!!!
Great.

> 
> What magic did you use and what does that mean?
Switched you back to the old (not clang-based) include resolving approach :-)
Comment 38 Vladimir Voskresensky 2016-11-29 13:10:57 UTC
Btw, in the upcoming 8.2 update it will be fixed.

But it would be great if you can help me to fix it for clang-based mode as well. I will add extra logging and will ask you to provide log traces. Are you OK?

Thanks!
Vladimir.
Comment 39 InfoGeek 2016-11-29 13:52:48 UTC
(In reply to Vladimir Voskresensky from comment #38)
> Btw, in the upcoming 8.2 update it will be fixed.
> 
> But it would be great if you can help me to fix it for clang-based mode as
> well. I will add extra logging and will ask you to provide log traces. Are
> you OK?
> 
> Thanks!
> Vladimir.

That would be the least I could do to repay your effort and contributions.
Comment 40 Quality Engineering 2016-12-03 03:02:20 UTC
Integrated into 'main-silver', will be available in build *201612030001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/886222538ed1
User: Vladimir Voskresensky <vv159170@netbeans.org>
Log: fixing #269098 - False 'cannot find include file' and related 'unable to resolve indentifier'
- added logging
(transplanted from cf8922bf122d6b1524fb74d672553559e6fe0fb3)
Comment 41 Alexander Simon 2017-03-29 08:21:05 UTC
Bug is reproduced in development build only.
Comment 42 Vladimir Voskresensky 2017-04-03 16:27:18 UTC
*** Bug 246881 has been marked as a duplicate of this bug. ***