Opened 3 years ago

Closed 3 years ago

#9911 closed Bugs (fixed)

[Interprocess] get_tmp_base_dir(...) failure

Reported by: Aaron_Wright@… Owned by: Ion Gaztañaga
Milestone: To Be Determined Component: interprocess
Version: Boost 1.55.0 Severity: Problem
Keywords: Cc:


In Boost 1.55 get_tmp_base_dir(...) is defined as such:

inline void get_tmp_base_dir(std::string &tmp_name)
      if(tmp_name.empty() || !winapi::is_directory(tmp_name.c_str())){
         tmp_name = get_temporary_path();
      tmp_name = get_temporary_path();
      error_info err = system_error_code();
      throw interprocess_exception(err);
   //Remove final null.
   tmp_name += "/boost_interprocess";

This makes an assumption in Windows that, if the "shared documents folder" is not usable, the temp folder should be used instead. I believe this is a bad assumption, and leads to silent run-time failures.

Every user in Windows is going to have a different temp folder. Thus, processes running under different users will not agree on the same base folder for boost_interprocess. This obviously defeats the purpose of shared memory.

I believe a failure to secure a shared location in Windows for boost_interprocess should result in an exception, not a fall back to the non-shared temp folder.

PS - It would be beneficial if the location of the boost_interprocess folder could be specified. Instead of relying on registry entries, environment variables, or Windows API voodoo, I can tell the library exactly what folder to use, and save everyone some work.

Attachments (0)

Change History (1)

comment:1 Changed 3 years ago by Ion Gaztañaga

Resolution: fixed
Status: newclosed

Implemented the suggested workaround in commit SHA-1: fb1b0e547c8afe60cb9c1a008ce38a8606f7536d (develop branch)

If the shared folder could not be found an exception is thrown and no temporary folder is tried. If BOOST_INTERPROCESS_SHARED_DIR_PATH is defined, that directory is used instead of the shared folder + bootstamp folder.

Modify Ticket

Change Properties
Set your email in Preferences
as closed The owner will remain Ion Gaztañaga.
The resolution will be deleted.

Add Comment

E-mail address and name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.