Boost C++ Libraries: Ticket #10205: FileSystem runtime error: locale::facet::_S_create_c_locale name not valid https://svn.boost.org/trac10/ticket/10205 <p> Ok this is still broken (see Ticket <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/5928" title="#5928: Bugs: FileSystem runtime error: locale::facet::_S_create_c_locale name not valid (closed: fixed)">#5928</a>). On Solaris 10 (sparc) compile this... </p> <p> #include &lt;iostream&gt; #include &lt;boost/filesystem.hpp&gt; </p> <p> int main (void) { </p> <blockquote> <p> std::cout &lt;&lt; boost::filesystem::unique_path("/some/random/path/%%%%%%%").c_str() &lt;&lt; std::endl; return 0; </p> </blockquote> <p> } </p> <p> linking against system and filesystem </p> <p> I had compiled boost_1_55_0 from the site and built just filesystem and system (because program_options fails to compile with gcc 4.9.0 but thats a separate issue). I created the above example in stage/lib folder and ran.. </p> <p> g++ test.cpp -I../../ -L. -lboost_filesystem -lboost_system </p> <p> Below are the results... </p> <p> bash-3.2$ locale LANG=en_GB.UTF-8 LC_CTYPE=en_GB.ISO8859-1 LC_NUMERIC=en_GB.ISO8859-1 LC_TIME=en_GB.ISO8859-1 LC_COLLATE=en_GB.ISO8859-1 LC_MONETARY=en_GB.ISO8859-1 LC_MESSAGES=C LC_ALL= -bash-3.2$ LC_ALL=en_GB.UTF-8 LD_LIBRARY_PATH=. ./a.out terminate called after throwing an instance of 'std::runtime_error' </p> <blockquote> <p> what(): locale::facet::_S_create_c_locale name not valid </p> </blockquote> <p> Abort (core dumped) -bash-3.2$ LD_LIBRARY_PATH=. ./a.out terminate called after throwing an instance of 'std::runtime_error' </p> <blockquote> <p> what(): locale::facet::_S_create_c_locale name not valid </p> </blockquote> <p> Abort (core dumped) -bash-3.2$ LC_ALL=en_GB.ISO8859-1 LD_LIBRARY_PATH=. ./a.out terminate called after throwing an instance of 'std::runtime_error' </p> <blockquote> <p> what(): locale::facet::_S_create_c_locale name not valid </p> </blockquote> <p> Abort (core dumped) -bash-3.2$ LC_ALL=C LD_LIBRARY_PATH=. ./a.out /some/random/path/7fff459 </p> <p> This is utterly crippling and renders boost filesystem useless on Solaris 10. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/10205 Trac 1.4.3 sleary@… Wed, 16 Jul 2014 19:01:21 GMT <link>https://svn.boost.org/trac10/ticket/10205#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10205#comment:1</guid> <description> <p> the issue is that wstring is used in unique path for POSIX targets. Which to me seems wrong but i'd bet there is a good reason for it. If i revert everything back to std::string in unique path and use a char type instead then it all works fine on Solaris 10. I'm guessing this is probably not something we'd want as a standard code path so perhaps we could have some sort of build flag for OSes that have issues with wchar? </p> <p> The issue seems to be something to do with the conversion from std::string to std:wstring. It only seems to work on Solaris 10 when LC_ALL=C. I'll attach a patch too. </p> </description> <category>Ticket</category> </item> <item> <author>sleary@…</author> <pubDate>Wed, 16 Jul 2014 19:02:16 GMT</pubDate> <title>attachment set https://svn.boost.org/trac10/ticket/10205 https://svn.boost.org/trac10/ticket/10205 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">10205.patch</span> </li> </ul> <p> Makes the issue go away on Solaris 10 (but not a proper fix) </p> Ticket sleary@… Wed, 16 Jul 2014 19:26:28 GMT attachment set https://svn.boost.org/trac10/ticket/10205 https://svn.boost.org/trac10/ticket/10205 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">demo.cpp</span> </li> </ul> <p> Demo of the issue in action on solaris </p> Ticket sleary@… Wed, 16 Jul 2014 19:29:31 GMT <link>https://svn.boost.org/trac10/ticket/10205#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10205#comment:2</guid> <description> <p> second attachment demos why the problem exists and can also trigger the issue on linux if you set LC_ALL badly. Still fail to understand why wstring() is used at all on posix systems. Would be better to typedef a filesystem string type and avoid wstring on everything except win32. </p> </description> <category>Ticket</category> </item> <item> <author>sleary@…</author> <pubDate>Wed, 16 Jul 2014 19:29:37 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/10205#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10205#comment:2</guid> <description> <p> second attachment demos why the problem exists and can also trigger the issue on linux if you set LC_ALL badly. Still fail to understand why wstring() is used at all on posix systems. Would be better to typedef a filesystem string type and avoid wstring on everything except win32. </p> </description> <category>Ticket</category> </item> <item> <author>kevinday.home@…</author> <pubDate>Tue, 05 Aug 2014 22:53:04 GMT</pubDate> <title>attachment set https://svn.boost.org/trac10/ticket/10205 https://svn.boost.org/trac10/ticket/10205 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">10205.parent_path.patch</span> </li> </ul> Ticket kevinday.home@… Tue, 05 Aug 2014 22:55:01 GMT <link>https://svn.boost.org/trac10/ticket/10205#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10205#comment:3</guid> <description> <p> Was seeing this behavior when using parent_path. I attached 10205.parent_path.patch that I used to make my issue go away. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Beman Dawes</dc:creator> <pubDate>Wed, 29 Oct 2014 15:18:26 GMT</pubDate> <title>status, severity, milestone changed https://svn.boost.org/trac10/ticket/10205#comment:4 https://svn.boost.org/trac10/ticket/10205#comment:4 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">assigned</span> </li> <li><strong>severity</strong> <span class="trac-field-old">Showstopper</span> → <span class="trac-field-new">Problem</span> </li> <li><strong>milestone</strong> <span class="trac-field-old">To Be Determined</span> → <span class="trac-field-new">Boost 1.57.0</span> </li> </ul> <p> This ticket brings up several issues: </p> <ol class="upperalpha" start="17"><li>Should 'boost::filesystem::unique_path("/some/random/path/%%%%%%%")' work, even if the default locale is invalid (E.G. LANG=foo)? </li><li>Yes. As of 1.57.0 final release, an default invalid locale should only cause a failure if a conversion is explicitly called for by user code. </li></ol><p> Action: fix unique_path code. </p> <ol class="upperalpha" start="17"><li>Should parent_path.patch be applied? </li><li>No. That constructor should no longer be calling path::codecvt(), so an invalid locale should not cause a failure. </li></ol><p> Action: Should already be fixed in develop, but test on Linux just to be sure. </p> <ol class="upperalpha" start="17"><li>Should demo.cpp work, even on POSIX when the default locale is invalid? </li><li>No. The call to path.wstring() is an explicit request for a conversion. </li></ol><p> Action: Check docs to see if requirement for valid locale is documented. </p> <p> I'll leave this ticket open until all the action items are completed. The target is 1.57.0, but time is very short. </p> <p> Thanks for the reports, </p> <p> --Beman </p> Ticket