HomePhorge

(maint) Dup frozen File content strings
fc18fadc8ef7Unpublished

Unpublished Commit · Learn More

Repository Importing: This repository is still importing.

Description

(maint) Dup frozen File content strings

Commit 2a9e996 froze all string tokens in the lexer as a performance
tweak. This caused a regression in file content behavior where

file { '/tmp/foo': content => stuff }

would fail with a 'Error: Could not set content on file: can't modify
frozen String' when using the future parser on Ruby 1.9.3 and up. The
Ruby version requirement was because we force_encoding to ASCII_8BIT on
platforms (1.9.3 and up) which allow this, but you can't do that to a
frozen string. This was failing in the lib/puppet/type/file/content.rb
should= method, where the string was cloned, but a clone() clones the
frozen state.

Other Types, including user defined types, may override should= or munge
and have similar problems, so we are adding a convert_String to the
runtime3_support to step around this problem. This still leaves the
basic problem of mutation of strings within resource instances, but that
is pre-existing.

Event Timeline

Josh Partlow <joshua.partlow@puppetlabs.com> committed rPUfc18fadc8ef7: (maint) Dup frozen File content strings (authored by Josh Partlow <joshua.partlow@puppetlabs.com>).Aug 5 2014, 11:41 PM