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

Segfault for default class variable in crystal 0.11.0 #2059

Closed
ysbaddaden opened this issue Jan 24, 2016 · 3 comments
Closed

Segfault for default class variable in crystal 0.11.0 #2059

ysbaddaden opened this issue Jan 24, 2016 · 3 comments
Labels
kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:compiler

Comments

@ysbaddaden
Copy link
Contributor

With Crystal 0.11.0, running the following program with no arguments will segfault when trying to access Test.logger. There are two ways to workaround the bug: 1. pass an argument to the program, which will set Test.logger, or 2. remove the Test.logger = Logger.new(file) line.

require "logger"

module Test
  def self.logger
    @@logger ||= Logger.new(STDOUT)
  end

  def self.logger=(@@logger)
  end
end

if ARGV[0]?
  Test.logger = Logger.new(File.open("test_logger.log", "w"))
end

Test.logger.info("ok")

Note that in doesn't fail with Crystal 0.10.2.

@asterite asterite added kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:compiler labels Jan 24, 2016
@asterite
Copy link
Member

Ouch, that's an ugly regression. My fault, I changed this line. There was even a spec for this but I decided to remove it because I couldn't find the logic in it. I re-added the spec tied to this issue, and added some comments.

With these regressions a 0.11.1 (or 0.12.0) will come out soon.

@ysbaddaden
Copy link
Contributor Author

Let's say 0.11.0 was a RC, and 0.11.1 is the real thing ;-)

@asterite
Copy link
Member

Hehe, yes. We actually talked about doing a RC with @waj, maybe we should start doing that.

Another thing that we talked about is having release branches, so we can cherry pick some fixes into 0.11.1 without including other things.

I guess this is normal, 0.11.0 changed and introduced a lot of things.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:compiler
Projects
None yet
Development

No branches or pull requests

2 participants