Opened 7 years ago

Closed 5 years ago

#4065 closed Bugs (fixed)

Boost Filesystem lexicographic path comparison inconsistent

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


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;


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


gives the following output:

/foo/ ? /foo/.

Attachments (0)

Change History (1)

comment:1 Changed 5 years ago by bemandawes

  • Resolution set to fixed
  • Status changed from new to closed

(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.

Add Comment

Modify Ticket

Change Properties
Set your email in Preferences
as closed The owner will remain bemandawes.
The resolution will be deleted. Next status will be 'reopened'.

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.