Bug #8311

file { mode => .. } -- investigation into strings, octal, etc --

Added by tgeeky - 11 months ago. Updated 11 months ago.

Status:Investigating Start date:07/07/2011
Priority:Normal Due date:
Assignee:tgeeky - % Done:

0%

Category:file
Target version:2.7.x
Affected Puppet version:2.7.1 Branch:
Keywords:file, mode, octal
Votes: 0

Description

This ticket is meant as an investigation into general problems with the following syntax:

file { '/some/file/or/directory':
       mode => _____
}

In theory, any of the following could be entered where ____ is:

  • 0
  • 1
  • 000000000
  • 0123
  • 1365
  • ‘0’
  • ‘0000’
  • ‘0777’
  • “0”
  • “0123”
  • “644”
  • “– – – – – – – – – –”
  • “– r w S r w S r w –”
  • “8000”
  • “81ff”

For instance, what should be valid here? How should puppet store (internally) the information you supply? What should happen when invalid input is supplied? Because Ruby is a dynamically typed language and because some joker decided that prefixing a number with a zero specifies an octal number, Puppet is left with some lingering bugs; and, even when a decision on syntax is made, backwards compatibility is not an easy task.

This bug report was spurred on by (but is not identical to) my other [bug report#8255]. That bug is just for the defaults (which is a puppet system also need of some TLC).

[This pastie] represents my first attack at actually figuring out what’s going on. It is nowhere near sufficient, and it’s not in test form (since I don’t know how to write tests yet).

There are probably several bugs that are caused by this inconsistency. And directories are not immune, either.

History

Updated by tgeeky - 11 months ago

Now, a pastie with the replacement:

s/decimal/squote/

s/(\d)/‘(\d)’/

[pastie]

Looking at this pastie and the first, the stat lines are identical. Perhaps not so bad after all.

Updated by tgeeky - 11 months ago

[This pastie] is a side-by-side diff of the first output and the second (with all the debugging output removed).

Also available in: Atom PDF