Details
-
Bug
-
Status: Resolved
-
Minor
-
Resolution: Duplicate
-
PUP 4.8.0
-
None
-
Coremunity
Description
This to reproduce:
$ cat x.pp
|
file { '/tmp/x~x':
|
content => "x\n",
|
}
|
|
file { '/tmp/~x':
|
content => "x\n",
|
}
|
|
file { '/tmp/x~':
|
content => "x\n",
|
}
|
$ puppet apply /tmp/x.pp
|
Notice: Compiled catalog for cwl.hostopia.com in environment production in 0.07 seconds
|
Error: Could not set 'file' on ensure: user x20161110-10084-1ubfm2v doesn't exist at /tmp/x.pp:5
|
Error: Could not set 'file' on ensure: user x20161110-10084-1ubfm2v doesn't exist at /tmp/x.pp:5
|
Wrapped exception:
|
user x20161110-10084-1ubfm2v doesn't exist
|
Error: /Stage[main]/Main/File[/tmp/~x]/ensure: change from absent to file failed: Could not set 'file' on ensure: user x20161110-10084-1ubfm2v doesn't exist at /tmp/x.pp:5
|
Notice: Applied catalog in 0.12 seconds
|
I can't by any stretch call myself a programmer, but it turns out people on stackoverflow are having related behaviour (huzzah googling for "ruby tilde filename", no quotes).
http://stackoverflow.com/questions/2504646/how-to-open-files-relative-to-home-directory
From the ruby docs, expand_path says that a ~user filename expands to that user's home directory. It doesn't seem to be quite what's going on here but it's still bringing in the username.
https://ruby-doc.org/core-2.1.8/File.html#method-c-expand_path
Sure enough, the file type uses expand_path to sort out where the :path is.
https://github.com/puppetlabs/puppet/blob/master/lib/puppet/type/file.rb
The bug part appears to be where the file type is implicitly presuming that the file path is not literal from the file resource, if I'm reading this right. (Not a programmer.)
Attachments
Issue Links
- duplicates
-
PUP-5800 Filenames in recursive directories appear to be shell expanded
-
- Resolved
-