Boost logo

Boost :

Subject: [boost] [filesystems]
From: Florian Lindner (mailinglists_at_[hidden])
Date: 2019-03-14 08:31:34


I have this innocent piece of code:

  namespace fs = boost::filesystem;
  auto path = getFilename(); // returns a string
  std::ofstream ofs(path + "~");
  ofs << info;
  fs::rename(path + "~", path);

which causes the exception:

boost::filesystem::rename: No such file or directory: "../9f/061b4f7a5e529c964659226eedd4e5~", "../9f/061b4f7a5e529c964659226eedd4e5"

However, I have no idea how that could happen. I use the rename, so that a reading process never sees an empty file, but only no file or filed with info. Is there any race involved between ofs.close() and fs:rename()? The code was executed on a distributed network filesystem (lustre).

Any ideas anyone?


Boost list run by bdawes at, gregod at, cpdaniel at, john at