Opened 10 years ago

Last modified 5 years ago

#8301 new Bugs

filesystem::canonical() has a race condition on Windows 7/10

Reported by: y.hoshizuki Owned by: Beman Dawes
Milestone: To Be Determined Component: filesystem
Version: Boost 1.59.0 Severity: Problem
Keywords: Cc:

Description

read_symlink() often throws a exception.

to confirm this problem, please compile and run the attached file.

i think it caused by read_symlink() opening a file exclusively.

    handle_wrapper h(
      create_file_handle(p.c_str(), GENERIC_READ, 0, 0, OPEN_EXISTING,
        FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_OPEN_REPARSE_POINT, 0));

FILE_SHARE_READ argument resolves this problem, isn't it?

Attachments (1)

canonical.cpp (1.3 KB ) - added by y.hoshizuki 10 years ago.
test program

Download all attachments as: .zip

Change History (2)

by y.hoshizuki, 10 years ago

Attachment: canonical.cpp added

test program

comment:1 by ladislav.sopko@…, 5 years ago

Summary: filesystem::canonical() has a race condition on Windows 7filesystem::canonical() has a race condition on Windows 7/10
Version: Boost 1.51.0Boost 1.59.0

We found the same ....

Note: See TracTickets for help on using tickets.