Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#12574 closed Bugs (invalid)

is_directory sets boost::system::errc::no_such_process when path contains more directory components

Reported by: Wojciech Muła <wojciech_mula@…> Owned by: Beman Dawes
Milestone: To Be Determined Component: filesystem
Version: Boost 1.62.0 Severity: Problem
Keywords: windows Cc:

Description

Assume there is a directory "/tmp", then is_directory("/tmp", error) returns true and sets error's value to success.

When we query for subdirectory, like is_directory("/tmp/foo", error), then the function returns false and sets error's value to no_such_file_or_directory. It is OK.

However, query like is_directory("/tmp/foo/bar") sets error's value to no_such_process. It is completely unexpected & counterintuitive. It seems that this value is returned when the part of path after an existing directory contains directory separator(s) -- here "foo/bar".

This happens on Windows, I haven't tested it on Linux.

Change History (2)

comment:1 by Beman Dawes, 6 years ago

Resolution: invalid
Status: newclosed

A test case has been added to operations_test.cpp. It passes just fine, and a display of the error code values shows 2 and 3 on Windows:

Windows error_code values
--------------------------------

2 ERROR_FILE_NOT_FOUND
3 ERROR_PATH_NOT_FOUND

See https://msdn.microsoft.com/en-us/library/windows/desktop/ms681382(v=vs.85).aspx

So it looks like you are confusing Windows specific error_code values with the portable error_condition values:

Generic error_condition values
-------------------------------------

2 no_such_file_or_directory
3 no_such_process

The ticket is being closed, but the tests are worth keeping so remain in operations_test.cpp.

comment:2 by Wojciech Muła <wojciech_mula@…>, 6 years ago

Thank you very much, I wasn't aware of the differences between error code and condition. Sorry for bothering you.

Note: See TracTickets for help on using tickets.