<html><head><style data-externalstyle="true">
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph {
margin-top:0in;
margin-right:0in;
margin-bottom:0in;
margin-left:.5in;
margin-bottom:.0001pt;
}

p.MsoListParagraphCxSpFirst, li.MsoListParagraphCxSpFirst, div.MsoListParagraphCxSpFirst, p.MsoListParagraphCxSpMiddle, li.MsoListParagraphCxSpMiddle, div.MsoListParagraphCxSpMiddle, p.MsoListParagraphCxSpLast, li.MsoListParagraphCxSpLast, div.MsoListParagraphCxSpLast {
margin-top:0in;
margin-right:0in;
margin-bottom:0in;
margin-left:.5in;
margin-bottom:.0001pt;
line-height:115%;
}
</style></head><body><div data-externalstyle="false" style="font-family:Calibri,'Segoe UI',Meiryo,'Microsoft YaHei UI','Microsoft JhengHei UI','Malgun Gothic','Khmer UI','Nirmala UI',Tunga,'Lao UI',Ebrima,sans-serif;font-size:16px;"><div>r_b_d != rbd</div><div> </div><div>Therefore, ${r_b_d} is the empty string.</div><div> </div><div data-signatureblock="true"> </div>     <div style="border-top-color: rgb(225, 225, 225); border-top-width: 1px; border-top-style: solid;">             <strong>From:</strong> Matthew Woehlke<br>               <strong>Sent:</strong> ‎March‎ ‎13‎, ‎2013 ‎8‎:‎51‎ ‎PM<br>          <strong>To:</strong> cmake-developers@cmake.org<br>              <strong>Subject:</strong> [cmake-developers] bizarre g_f_c(REALPATH) bug; works backwards(?!)<br>        </div>    <div> </div>I've discovered an odd an seemingly incorrect behavior of <br>get_filename_component(REALPATH)... apparently there are some conditions <br>when it can take a canonical path and turn it *back into a symlink*.<br><br>To reproduce:<br><br>$ ls -l<br>lrwxrwxrwx. 1 matthew matthew   10 Mar 13 20:17 build -> real-build<br>drwxrwxr-x. 3 matthew matthew 4096 Mar 13 20:32 real-build<br>drwxrwxr-x. 2 matthew matthew 4096 Mar 13 20:30 real-src<br>lrwxrwxrwx. 1 matthew matthew    8 Mar 13 20:17 src -> real-src<br><br>$ cat src/CMakeLists.txt<br>cmake_minimum_required(VERSION 2.8.10)<br>project(Foo)<br>get_filename_component(rbd "${CMAKE_BINARY_DIR}" REALPATH)<br>get_filename_component(rp "${r_b_d}/foo.h" REALPATH)<br>message(STATUS "Expected value of real_path : '${r_b_d}/foo.h'")<br>message(STATUS "Actual value of real_path   : '${rp}'")<br><br>$ ROOT=$PWD<br><br>$ cd build<br><br>$ cmake $ROOT/src<br>-- Expected value of real_path : '/path/to/real-build/foo.h'<br>-- Actual value of real_path   : '/path/to/build/foo.h'<br>-- Configuring done<br>-- Generating done<br>-- Build files have been written to: /path/to/build<br><br>I'm almost afraid to think how REALPATH is implemented that it has this <br>ability that normally shouldn't be possible. I also can't imagine how it <br>is correct, since the result of REALPATH contains a resolvable symbolic <br>link, in complete contradiction to the documentation.<br><br>(Notes: This only happens if foo.h does not exist. 'readlink -f' gives <br>the expected result for the same input.)<br><br>Thoughts? Time to file a bug?<br><br>-- <br>Matthew<br><br>--<br><br>Powered by www.kitware.com<br><br>Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html<br><br>Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ<br><br>Follow this link to subscribe/unsubscribe:<br>http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers<br></div></body></html>