OMNeT++/OMNEST Bug Tracker - OMNeT++
View Issue Details
0001051OMNeT++simulation kernelpublic2018-09-18 09:032018-09-19 09:23
andras 
andras 
normalminorhave not tried
newopen 
LinuxUbuntu16.04
5.4.1 
 
0001051: Module class not found due to soft links in the NED folder's path
It is possible to get the "Class X not found" error for a module class when there is a soft link in the path.

This occurs when:
- the class is in a C++ namespace
- @namespace is declared in a package.ned in an ancestor directory
- the path to the NED folder contains a soft link
- the NED path (-n option) is specified with an absolute path.

The reason is that the package.ned is not found when looking up the namespace for the class; and the reason for that is that getcwd() resolves soft links leading to an alternative pathname for the package.ned, which causes it not to be found in a map indexed by path name.
No tags attached.
Issue History
2018-09-18 09:03andrasNew Issue
2018-09-18 09:14andrasNote Added: 0001370
2018-09-18 09:18andrasNote Added: 0001371
2018-09-18 09:19andrasAssigned To => andras
2018-09-18 09:19andrasStatusnew => confirmed
2018-09-18 09:20andrasStatusconfirmed => new
2018-09-18 09:24andrasNote Added: 0001372
2018-09-19 09:23attilaNote Added: 0001377

Notes
(0001370)
andras   
2018-09-18 09:14   
Steps to reproduce.

Create the following files:

==> x/package.ned <==
@namespace(ns);

==> x/omnetpp.ini <==
[General]
network=inet.Foo

==> x/inet/Foo.ned <==
package inet;
simple Foo { @class(Foo); @isNetwork(true); }

==> x/inet/Foo.cc <==
#include <omnetpp.h>
namespace ns {
class Foo : public omnetpp::cSimpleModule {};
Register_Class(Foo);
}

Build an executable simulation and try it:

cd x
opp_makemake --deep
make
./x # works fine
 
Then create a softlink to x, and run the simulation:

cd ..
ln -s x x-softlinked
cd x-softlinked
pwd # /home/you/.../x-softlinked (abs path w/ softlink)
./x -n $(pwd) # error: class not found
(0001371)
andras   
2018-09-18 09:18   
Suggested workaround: resolve symlinks before passing the path to the -n (NED path) option, e.g. using realpath.

The following will fix the above example:

./x -n $(realpath $(pwd))
(0001372)
andras   
2018-09-18 09:24   
related bug: 0000813 Recursive folder symlink in Ned search path generates infinite loop setting up simulation
(0001377)
attila   
2018-09-19 09:23   
Also see the investigation in: https://github.com/riebl/artery/issues/28 [^]