Opened 8 years ago

Closed 6 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:


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 6 years ago by Beman Dawes

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.

Modify Ticket

Change Properties
Set your email in Preferences
as closed The owner will remain Beman Dawes.
The resolution will be deleted.

Add Comment

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

Note: See TracTickets for help on using tickets.