I think that the problems with the BUILD_DIR check and symlinks may be
rearing their ugly heads again, both with Hazen on MacOS and with the 
Debian autobuilt packages. I would like to bury this problem once and 
for all.

The problem is that paths used by CMAKE are from the shell. The shell
remembers how you reached a particular directory and so the path is a
logical path, including symlinks. Plplot uses getcwd to get the path.
This is the physical path to the directory and so any symlinks are
resolved. If the build directory path contains symlinks then these two 
will be different and plplot will fail to realise that we are in the 
build tree.

There are a couple of possible solutions, none of which are ideal.

1) Use realpath (conforms to 4.4BSD and POSIX.1-2001). The Linux man
pages strongly recommend not using this since the design is broken and
it is impossible to be safe about making sure buffers are big enough.

2) Use the readlink command (available on Linux as standard) which will
give the physical path of an argument. We could use this in the cmake
scripts when setting BUILD_DIR. Might not be available on other systems
so we would need to check.

3) Code our own check. The simplest(?) portable way of doing this might
be to chdir to BUILD_DIR, call getcwd and compare to the previous cwd. 
This should work on all systems. 

I have implemented option (3) as the most portable solution, unless 
anyone has any better ideas.

Andrew


-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell.  From the desktop to the data center, Linux is going
mainstream.  Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
_______________________________________________
Plplot-devel mailing list
Plplot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plplot-devel

Reply via email to