This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/82777] New: incorrect result of std::filesystem::path::lexically_normal
- From: "hotwatermorning at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 31 Oct 2017 02:01:56 +0000
- Subject: [Bug libstdc++/82777] New: incorrect result of std::filesystem::path::lexically_normal
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82777
Bug ID: 82777
Summary: incorrect result of
std::filesystem::path::lexically_normal
Product: gcc
Version: 8.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
Assignee: unassigned at gcc dot gnu.org
Reporter: hotwatermorning at gmail dot com
Target Milestone: ---
With gcc HEAD 8.0.0 20171029, std::filesystem::path::lexically_normal() returns
an incorrect path.
And maybe because of this bug, std::filesystem::weakly_canonical() also returns
an incorrect path.
#include <iostream>
#include <filesystem>
namespace fs = std::filesystem;
using namespace std;
int main()
{
fs::create_directories("./a/b");
fs::path p("./a/b/c/../.././b/c");
// except "a/b/c"
// but the result will be "a/b/../b/c"
cout << "lexically canonical :" << p.lexically_normal() << endl;
// except "/path-to/current-dir/a/b/c"
// but the result will be "/path-to/current-dir/a/b/b/c"
cout << "weakly_canonical : " << fs::weakly_canonical(p) << endl;
}
An executable version is here.
https://wandbox.org/permlink/FFxvS5OwA51iyQ5B