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

Frozen string error in latest commit (125191f) #1027

Closed
aaronwieberg opened this issue Jun 24, 2020 · 3 comments
Closed

Frozen string error in latest commit (125191f) #1027

aaronwieberg opened this issue Jun 24, 2020 · 3 comments

Comments

@aaronwieberg
Copy link

Error:

/lib/language_pack/helpers/binstub_wrapper.rb:59:in 'force_encoding': can't modify frozen String (FrozenError)
from /lib/language_pack/helpers/binstub_wrapper.rb:59:in 'valid_utf8?'
from /lib/language_pack/helpers/binstub_wrapper.rb:55:in 'binary?'
from /lib/language_pack/helpers/binstub_wrapper.rb:31:in 'bad_shebang?'

shebang.force_encoding("UTF-8").valid_encoding?

When shebang returns "", that is a frozen string literal. Changing that line to shebang.dup.force_encoding("UTF-8").valid_encoding? may work, not sure if that is the best solution. Thanks!

@schneems
Copy link
Contributor

Thanks for the issue. I'll update it.

schneems added a commit that referenced this issue Jun 24, 2020
Since the `binstub_wrapper` is using the magic frozen comment any string literals will be immutable. The `force_encoding` method apparently mutates the string so this raises an error. 

By always returning a mutable string we can avoid this situation.
@schneems
Copy link
Contributor

I've got a fix here #1028

It looks like you've got an empty file in your bin/ folder. Do you know what file it is or where it's coming from?

@aaronwieberg
Copy link
Author

Ah yes, in my bin there's a .keep file that is empty File.new('/app/bin/.keep').readline => EOFError.

krisrang added a commit to skyltmax/heroku-buildpack-ruby that referenced this issue Oct 2, 2020
* upstream/master:
  [changelog skip] Bring back rake task (heroku#1038)
  CNB: make the gems layer accessible to subsequent buildpacks heroku#1033  (heroku#1037)
  [close heroku#934] Skip rake task if it does not exist (heroku#1036)
  [changelog skip] Move unreleased changelogs (heroku#1035)
  v218 for Monday release (heroku#1034)
  [close heroku#1029] Remove default bin/rake binstub (heroku#1031)
  Document v217 release in master (heroku#1030)
  [close heroku#1027][changelog skip] Fix frozen string error (heroku#1028)
  Handle binary binstubs (heroku#1021)
  v216 release for monday (heroku#1023)
  Revert "Merge pull request heroku#1014 from heroku/schneems/fu-binstubs"
  [close heroku#990] Warn on bad shebang line
  [close heroku#818] Disable spring
  [changelog skip][close heroku#977] Recommend recent Ruby in warning
  [changelog skip][close heroku#977] Recommend recent Ruby in warning
  [close heroku#1001] Put Yarn first on the path
  Update HEREDOC to 2.5 syntax to support indenting
  Switch to using /usr/bin/env bash
  [changelog skip] Fix CNB tests
  Allow Nolockfile to get to compile phase
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

No branches or pull requests

2 participants