couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Davis <paul.joseph.da...@gmail.com>
Subject Re: ejson fix for old vs new versions of Erlang
Date Thu, 07 Apr 2011 17:31:02 GMT
On Thu, Apr 7, 2011 at 10:06 AM, Filipe David Manana
<fdmanana@apache.org> wrote:
> Hi Matt,
>
> Thanks for the finding and the patch.
> I would prefer to return 'true' not only if we're on R13B03 but also
> if the release is older than that.
> Also, instead of using the erts version, I think it's easier to use
> the otp release, since people refer to otp versions mostly by the
> release version on not by the erts version (I might be wrong here).
> Do you agree with the following?
>
> diff --git a/src/ejson/ejson.erl b/src/ejson/ejson.erl
> index 2b26444..11f3b79 100644
> --- a/src/ejson/ejson.erl
> +++ b/src/ejson/ejson.erl
> @@ -27,7 +27,12 @@ init() ->
>         filename:join(Dir, ejson)
>     end,
>     (catch erlang:load_nif(SoName, 0)),
> -    ok.
> +    case erlang:system_info(otp_release) =< "R13B03" of
> +    true ->
> +        true;
> +    false ->
> +        ok
> +    end.
>
>
>
> On Thu, Apr 7, 2011 at 2:32 PM, Matt Goodall <matt.goodall@gmail.com> wrote:
>> Hi,
>> The new ejson module doesn't support older versions of Erlang because the
>> expected result from the module's on_load fun changed from true to ok.
>> The attached one-line change (as a git diff) fixes it for me using the
>> standard Erlang packages on Ubuntu 10.10 and 11.04 but I don't have a newer
>> version of Erlang installed to test against.
>> Obviously, with this change applied I'm still using the non-NIF json
>> implementation but at least the ejson module loads ;-).
>> - Matt
>
>
>
> --
> Filipe David Manana,
> fdmanana@gmail.com, fdmanana@apache.org
>
> "Reasonable men adapt themselves to the world.
>  Unreasonable men adapt the world to themselves.
>  That's why all progress depends on unreasonable men."
>

Also, we never bumped the minimum Erlang version requirement. I'm not
entirely sure what would happen on R12 with that -on_load even being
there.

Mime
View raw message