Skip to content

filesystem::is_directory() returns wrong result for directories on smb 1 network shares #282

Description

@boytsovea

We have switched our codebase from boost 1.61 to 1.80 and observed wrong behaviour of function is_directory(p) for some directories located on some network shares. Namely, this function returns that filesystem object is not a directory even in reality it is. After some investigations we were able to reproduce the issue on a virtual machine, which runs smb version 1 network share. The following code (here "\WIN-ZL5F8K2HI90\Users\Default" is beforementioned smb1 network share on a virtual machine):

#include <boost/filesystem.hpp>
#include <iostream>
#include <fileapi.h>

int main()
{
   bool res = boost::filesystem::is_directory( L"\\\\WIN-ZL5F8K2HI90\\Users\\Default" );
   std::cout << res << std::endl;
   DWORD win_api_res = GetFileAttributesW( L"\\\\WIN-ZL5F8K2HI90\\Users\\Default" );
   std::cout << win_api_res << std::endl;
   return 0;
}

produces the following output:

0 // that is boost::filesystems thinks that "\WIN-ZL5F8K2HI90\Users\Default" is not a directory
19 // that is GetFileAttributesW states that "\WIN-ZL5F8K2HI90\Users\Default" is a directory

We believe that the root cause of the issue is commit 97722a3

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions