Opened 9 years ago

Closed 8 years ago

Last modified 6 years ago

#9219 closed Bugs (fixed)

path::codecvt() is called when not required

Reported by: Andrey Semashev Owned by: Beman Dawes
Milestone: Boost 1.57.0 Component: filesystem
Version: Boost 1.54.0 Severity: Problem
Keywords: Cc: raad@…

Description

Some path functions (including assignment and constructor) are templated so that they can be called with arguments other than path. The templated functions are not supposed to be used when the argument is compatible with the native path string type. However, the templated functions are called anyway because the is_pathable trait is overly permissive (it returns true even for compatible types). This happens because the templated functions turn out to be more preferable than non-templated ones. For example:

path p = getcwd(); // calls path::path<char*>(char*) instead of non-templated path::path(const char*)

The above example is actually what happens in filesystem::current_path(), but obviously is not limited by that.

Given the other problems with the global locale (#8642, for example) this makes Boost.Filesystem unusable for Boost.Log because there is no way to use it without requiring codecvt() to be called at some point.

Change History (3)

comment:1 by Beman Dawes, 8 years ago

Milestone: To Be DeterminedBoost 1.57.0
Severity: ShowstopperProblem
Status: newassigned

I'm working this ticket now. Seems like it is a symptom of a class of errors that are difficult to test for because it is not obvious how to observe the behavior in a test framework. I'll probably post something soon to the developers list about this testing problem.

Thanks,

--Beman

comment:2 by Beman Dawes, 8 years ago

Resolution: fixed
Status: assignedclosed

Non-const overloads were needed. Fixed in develop. Will merge to master in a few days.

Thanks,

--Beman

comment:3 by raad@…, 6 years ago

Cc: raad@… added
Note: See TracTickets for help on using tickets.