Issue #17994 has been reported by Daniel Grafe.

----------------------------------------
Bug #17994: Symbolic file modes when creating directories: Wrong permissions
https://projects.puppetlabs.com/issues/17994

Author: Daniel Grafe
Status: Unreviewed
Priority: Normal
Assignee: 
Category: 
Target version: 
Affected Puppet version: 2.7.19
Keywords: 
Branch: 


Using symbolic modes when creating directories gives an additional sticky bit 
on the directory:

testcase:
<pre>
file { "/tmp/testdir":
  ensure => directory,
  mode   => "u=rwx,go=x"
}
</pre>


Result:
<pre>
> rm -rf /tmp/testdir/
> puppet /tmp/symbolic_mode_test.pp 
warning: Implicit invocation of 'puppet apply' by passing files (or flags) 
directly
to 'puppet' is deprecated, and will be removed in the 2.8 series.  Please
invoke 'puppet apply' directly in the future.

notice: /Stage[main]//File[/tmp/testdir]/ensure: created
notice: Finished catalog run in 0.50 seconds
> ls -la /tmp/ | grep testdir
drwx-----T   2 root     root     4096  6. Dez 09:36 testdir

</pre>


The method for converting symbolic file modes to octals is expecting an octal 
as second parameter. But when creating directories a numeric with base 10 is 
passed. Prefixing this value with a '0' specifying an octal would fix the bug.

In lib/puppet/type/file/ensure.pp:
<pre>
 Dir.mkdir(@resource[:path], symbolic_mode_to_int(mode, 755, true))
                                                         ^
                                                         |- changing to 0755 
will fix the problem
</pre>

I'm filing this against 2.7.19. But since the relevant code has not been 
changed the reported bug should also be reproducable on 3.x


-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://projects.puppetlabs.com/my/account

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" group.
To post to this group, send email to puppet-bugs@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-bugs+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-bugs?hl=en.

Reply via email to