Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update encode_util.rb #25

Closed
wants to merge 1 commit into from
Closed

Update encode_util.rb #25

wants to merge 1 commit into from

Conversation

reese-li
Copy link

@reese-li reese-li commented Nov 4, 2015

Get rid of "can't modify frozen string" error.

Get rid of "can't modify frozen string" error.
@jlee-r7
Copy link

jlee-r7 commented Mar 3, 2016

In what scenario does this manifest? Nothing I can find in this codebase freezes any strings.

@mwrock
Copy link
Member

mwrock commented Mar 4, 2016

I'd bet its coming from a frozen string passed to Client.new. Either the username, password or one of the options that gets passed to oem_or_unicode_str and then forwarded to encode_utf16le from there. This would happen if user got set from ENV['USERNAME'] or domain was set from ENV['USERDOMAIN'].

irb(main):006:0> a=ENV['USERNAME']
=> "mwrock"
irb(main):007:0> a=a.force_encoding('utf-8')
RuntimeError: can't modify frozen String
        from (irb):7:in `force_encoding'
        from (irb):7
        from C:/opscode/chefdk/embedded/bin/irb:11:in `<main>'

@mwrock
Copy link
Member

mwrock commented Mar 4, 2016

I'm 👍 on this

@mwrock
Copy link
Member

mwrock commented Sep 15, 2016

I totally forgot about this PR when submitting #30 last night. That one closes an additional possible hole. Also ir just deletes the first line of the encode method. Anyone see any potential problem deleting that line?

@zenchild
Copy link
Member

I think we can safely delete it.

@zenchild
Copy link
Member

@mwrock Do you want to just remove that line in your PR and we can just close this PR?

@mwrock
Copy link
Member

mwrock commented Sep 15, 2016

That sounds good. Closing in favor of #30 but thanks much @reese-li!

@mwrock mwrock closed this Sep 15, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants