-
-
Notifications
You must be signed in to change notification settings - Fork 54
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
Serialization of Nil object crashes the CLI #57
Comments
I am encountering what appears to be a similar issue. Looks like it comes from #!/usr/bin/env nix-shell
#! nix-shell -i ruby -p bundler bundix
require 'bundix'
require 'bundix/commandline'
bundix_cli = Bundix::CommandLine.new.tap(&:parse_options)
bundix = Bundix.new(bundix_cli.options)
cache = bundix.parse_gemset
lock = bundix.parse_lockfile
dep_cache = bundix.build_depcache(lock)
unhandled_platforms = lock.specs.flat_map do |spec|
dep_cache.fetch(spec.name).platforms.reject do |platform_name|
Bundix::PLATFORM_MAPPING.key? platform_name.to_s
end
end
puts unhandled_platforms.sort.uniq.to_a
And, FWIW:
Happy to provide any additional information on my environment if it would be helpful. I am not sure what action Bundix should take in response to an unrecognized platform -- ignore it? Issue an exception? Auto-generate a hash? E.g.: # bundix.rb
PLATFORM_MAPPING = Hash.new do |platform_mapping, platform_name|
case platform_name_s = platform_name.to_s
when /(\w+)_(\d+)/
version = $2.chars.join('.')
platform_mapping[platform_name_s] = {:engine => $1, :version => version}
else
platform_mapping[platform_name_s] = {:engine => platform_name_s}
end
end |
I also faced a similar error when trying to create a Rails environment. Command:
Error:
Has this problem been ignored for a long time? |
This bug currently prevents bundix from running on freshly generated rails apps. |
@quickdudley I have pushed up a fix in my fork. Feel free to give it a try |
Thanks you @inscapist ! Your fork fixed my problem (I couldn't start a Might I be so bold as to suggest raising the priority of this issue, as it's morphed into something that breaks a key use case, and we seem to have a fix. Then maybe close #12 a bit later?
For other confused noobs wondering how I eventually solved my problem and got Rails working, I used instructions and software from https://github.com/inscapist/ruby-nix to generate a |
Reproduce the bug
While trying to generate a
gemset.nix
with Bundix I got the following error and stacktrace:This happened to me with a generic 'gem'
Gemfile
:With the gem specification in the
*.gemspec
file:Quick fix
After applying a manual patch to handle
nil
object in the serializercase
in bundix, the result works (with some extra junk in theplatforms
list of some gems)Solution
I would rather have someone from the maintainer of
bundix
to check if it is safe to simply handle thenil
cases in the serializer or if the problem comes from somewhere else before submitting a PR.The text was updated successfully, but these errors were encountered: