core/host/mkdir perms applied too liberally

Bug #1361866 reported by David Britton
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Charm Helpers
New
Medium
Unassigned

Bug Description

In the case of creating leading paths (os.makedirs) with restrictive permissions and setting a user, I think the behavior of host.mkdirs() is confusing. You will easily run into a situation where you lock the target user out of the created directory.

EX:

  host.mkdirs("/tmp/leading/target", owner="daemon", group="daemon", perms=0700)

this will create

  /tmp/leading as 0700 owner root/root

and

  /tmp/leading/target as 0700 owner daemon/daemon

Which will yield an unreadable dir for daemon/daemon. Instead, I think what would be expected is for just the leaf dir to get the altered permissions, and altered user/group. Typically when calling mkdir -p you are concerned about creating the leaf dir and a "don't care" about the leading paths. It would be nice if thi behavior was reflected (and documented) in the function.

Tags: landscape
David Britton (dpb)
tags: added: landscape
Changed in charm-helpers:
importance: Undecided → Medium
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.