2

I use boost 1.75, and on a particular CentOS-8 docker container runs on Ubuntu-18 I get an exception with boost::filesystem::exists() even with a valid path. But if I use the same docker runs on local Mac or Ubuntu-18 there's no issue.

Here is the exception: C++ exception with description "boost::filesystem::status: Operation not permitted: "../path/

filesystem::path path = filesystem::current_path();
boost::filesystem::exists(path); // throws the same exception
file_status s = boost::filesystem::status(path); // throws the same exception

I'm not sure something missed with building the boost static libraries. For the same OS the boost 1.64 has no issue with the above code.

OS : CentOS-8

Compiler : gcc 8.3.1

boost : 1.75, compiled on local CentOS-8 docker with gcc-8.3.1.

njohn
  • 81
  • 6
  • 1
    Not sure if it is related but when I had problems with Boost filesystem, the reason was an ABI change between different gcc versions (Boost was compiled with a really old gcc and I was trying to compile my program with a relatively new gcc). So make sure Boost is compiled with a compatible ABI. – paleonix Apr 25 '21 at 19:34
  • 1
    @PaulG. Sorry missed to mention that the boost is compiled on CentOS-8 using gcc-8.3.1. Updated the description with more details. – njohn Apr 25 '21 at 20:04
  • Looks like something was truncated here: _`"boost::filesystem::status: Operation not permitted: "../path/`_. Can you post the entire message, preferrable as a code block, so it's fully intact? In particular the `../` gives me the idea that you're looking at a genuine permissions issue due to security restrictions. – sehe Apr 25 '21 at 22:29

1 Answers1

2

Had this problem at work. Running docker run --privileged "solved" the issue. We ended up replacing boost::filesystem::exists() with std::filesystem::exists() which solved the issue without the --privileged flag (gcc10 though).

Niclas Larsson
  • 1,317
  • 8
  • 13