Details
-
Improvement
-
Status: Closed
-
Major
-
Resolution: Fixed
-
PUP 4.4.1
-
-
Agent
-
3
-
AP 2016-10-19, AP 2016-11-02, AP 2016-11-16, AP 2016-11-30, AP 2016-12-14
-
Not Needed
-
No Action
-
N/A [mass update]: Various build, documentation, infra, or test-related issues
Description
The current FileSystem.open implementation is a bit peculiar at https://github.com/puppetlabs/puppet/blob/master/lib/puppet/file_system/file_impl.rb#L30-L32:
def open(path, mode, options, &block) |
::File.open(path, options, mode, &block) |
end |
The signature of the underlying Ruby method is open(filename [, mode [, perm]] [, opt], &block) - which means that we have shuffled and renamed some of Rubys parameters:
- Rubys perm in our call is renamed as mode, and is moved from position 2 to position 1
- Rubys mode in our call is renamed as options, and is moved from position 1 to position 2
- We don't support the passing in of Rubys opt which is where one would set :encoding => 'utf-8'
Fortunately there are only a few callsites which use FileSystem.open that are currently impacted:
- directory_setting.rb - https://github.com/puppetlabs/puppet/blob/e99b2ae79225293763bbb4eeba39e75920dd0d80/lib/puppet/settings/directory_setting.rb#L9
- file_or_directory_setting.rb - https://github.com/puppetlabs/puppet/blob/e99b2ae79225293763bbb4eeba39e75920dd0d80/lib/puppet/settings/file_or_directory_setting.rb#L30
- file_setting.rb - https://github.com/puppetlabs/puppet/blob/e99b2ae79225293763bbb4eeba39e75920dd0d80/lib/puppet/settings/file_setting.rb#L190-L197
- face/config.rb - https://github.com/puppetlabs/puppet/blob/e99b2ae79225293763bbb4eeba39e75920dd0d80/lib/puppet/face/config.rb#L111
- file_bucket/file.rb - https://github.com/puppetlabs/puppet/blob/e99b2ae79225293763bbb4eeba39e75920dd0d80/lib/puppet/file_bucket/file.rb#L128
- indirector/file_bucket_file/file.rb - https://github.com/puppetlabs/puppet/blob/e99b2ae79225293763bbb4eeba39e75920dd0d80/lib/puppet/indirector/file_bucket_file/file.rb#L118 - multiple hits here
Note that both the calls to FileSystem.open and FileSystem.exclusive_open are impacted.
At the time this PR goes up, another scan should occur to make sure that all callsites are corrected.
Attachments
Issue Links
- is blocked by
-
PUP-6876 Puppet::Settings::IniFile doesn't handle Unicode keys / sections properly - can cause `config set` / `config print` failures
-
- Closed
-
- relates to
-
PUP-6875 [Spike] Investigate usage of ReGex \w character class in Puppet
-
- Ready for Engineering
-
-
PUP-6876 Puppet::Settings::IniFile doesn't handle Unicode keys / sections properly - can cause `config set` / `config print` failures
-
- Closed
-
-
PUP-6260 SPIKE - PUP-6188 determine how we can test 6188
-
- Closed
-
-
PUP-6959 Puppet::FileSystem.open / exclusive_open / replace_file should use Windows file system support for setting `mode`
-
- Ready for Engineering
-
-
PUP-6904 Evaluate FileType and ParsedFile classes for UTF-8 compatibility
-
- Closed
-
-
PUP-6925 Convert Ruby ::File calls for open to Puppet::FileSystem and explicitly specify encoding
-
- Closed
-
-
PUP-7134 Convert Ruby ::File calls for open to Puppet::FileSystem and explicitly specify encoding for SSL files
-
- Closed
-
-
PUP-1583 Non ASCII comments in puppet.conf causes exception
-
- Resolved
-
-
PUP-5879 Ensure Puppet uses FileSystem.read where applicable to read JSON, settings and other files as UTF-8
-
- Closed
-