Opened 13 years ago

Closed 11 years ago

#4065 closed Bugs (fixed)

Boost Filesystem lexicographic path comparison inconsistent

Reported by: dbetz@… Owned by: Beman Dawes
Milestone: Boost 1.43.0 Component: filesystem
Version: Boost Development Trunk Severity: Showstopper
Keywords: filesystem, lexicographic_compare Cc:

Description

I am using boost svn number 60558. Briefly, paths "/foo/" and "/foo/." are not <, >, or ==:

#include <iostream>

#include <boost/filesystem.hpp>

int main(int argc, char *argv[]){

boost::filesystem::path p("/foo/"); boost::filesystem::path q("/foo/."); if (p<q)

std::cerr << p << " < " << q << std::endl;

else if (p==q)

std::cerr << p << " == " << q << std::endl;

else if (p>q)

std::cerr << p << " > " << q << std::endl;

else

std::cerr << p << " ? " << q << std::endl;

}

gives the following output:

/foo/ ? /foo/.

Change History (1)

comment:1 by Beman Dawes, 11 years ago

Resolution: fixed
Status: newclosed

(In [77669]) Fix #4065, Boost Filesystem lexicographic path comparison inconsistent. The fix included adding path::compare functions, and cleanup and refactoring of the path relational operators code. Some of the code fixed is used by other functions, so some unrelated bugs may also have been fixed.

Note: See TracTickets for help on using tickets.