Boost C++ Libraries: Ticket #12836: the function canonical invalidates a path if there is double dot between two symbolic links https://svn.boost.org/trac10/ticket/12836 <p> Create unit test like this: </p> <div class="wiki-code"><div class="code"><pre> <span class="kt">void</span> <span class="nf">test</span><span class="p">()</span> <span class="p">{</span> <span class="k">namespace</span> <span class="n">fs</span> <span class="o">=</span> <span class="n">boost</span><span class="o">::</span><span class="n">filesystem</span><span class="p">;</span> <span class="k">const</span> <span class="n">fs</span><span class="o">::</span><span class="n">path</span> <span class="n">base_path</span> <span class="o">=</span> <span class="n">createBaseDir</span><span class="p">();</span> <span class="c1">// prepare hierarchy</span> <span class="n">fs</span><span class="o">::</span><span class="n">create_directories</span><span class="p">(</span><span class="n">base_path</span> <span class="o">/</span> <span class="s">&quot;a/b/c&quot;</span><span class="p">);</span> <span class="n">fs</span><span class="o">::</span><span class="n">create_directory_symlink</span><span class="p">(</span><span class="n">base_path</span> <span class="o">/</span> <span class="s">&quot;a/b&quot;</span><span class="p">,</span> <span class="n">base_path</span> <span class="o">/</span> <span class="s">&quot;sym&quot;</span><span class="p">);</span> <span class="c1">// base/sym -&gt; base/a/b</span> <span class="k">const</span> <span class="n">fs</span><span class="o">::</span><span class="n">path</span> <span class="n">test1</span> <span class="o">=</span> <span class="n">base_path</span> <span class="o">/</span> <span class="s">&quot;sym/../sym/c&quot;</span><span class="p">;</span> <span class="c1">// if a symbolic link is resolved first will be ../s2 exist?</span> <span class="n">TS_ASSERT</span><span class="p">(</span><span class="n">fs</span><span class="o">::</span><span class="n">exists</span><span class="p">(</span><span class="n">test1</span><span class="p">));</span> <span class="n">TS_ASSERT</span><span class="p">(</span><span class="n">fs</span><span class="o">::</span><span class="n">exists</span><span class="p">(</span><span class="n">fs</span><span class="o">::</span><span class="n">canonical</span><span class="p">(</span><span class="n">test1</span><span class="p">)));</span> <span class="p">}</span> </pre></div></div><p> Test verify that path test1 exists, but the second calling of this function fails for a normalized path by function <em>canonical</em>. It should work otherwise the function is not reliable. The problem can be resolved if the function <em>canonical</em> first strip path from a dot and double dot and then resolve symbolic links. </p> <p> I run the unit test only on Windows, but it should be no difference. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/12836 Trac 1.4.3