Opened 8 years ago

Last modified 7 years ago

#11179 new Feature Requests

create_directories() does not allow control of permissions

Reported by: Michi Henning <michi.henning@…> Owned by: Beman Dawes
Milestone: To Be Determined Component: filesystem
Version: Boost 1.57.0 Severity: Problem
Keywords: Cc:

Description

Currently, there is no way to tell create_directory() or create_directories() what permissions to set for a new directory. This is particularly annoying when calling these functions from a library, where it's simply impossible to fiddle with umask.

It would be really nice to have an overload that allows permissions to be set.

Change History (2)

comment:1 by anonymous, 7 years ago

Seconded, being unable to pass permissions (and being unable to adjust the umask) opens an attack vector, with the directory being created with wide open permissions before being able to fix up the permissions. The following example illustrates the issue:

  fs::create_directories(p);
  // There is a potential race here. Also note that
  // fs::permissions only fixes up the permissions for the last directory on the path.
  fs::permissions(p, fs::perms::owner_all);

Being able to pass permissions to create_directories would help with the race and would make it easier for developers to do the right thing (tm).

comment:2 by thomas.voss@…, 7 years ago

s/anonymous/thomas.voss@…/ :)

Note: See TracTickets for help on using tickets.