summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon MacMullen <simon@rabbitmq.com>2014-09-24 12:26:30 +0100
committerSimon MacMullen <simon@rabbitmq.com>2014-09-24 12:26:30 +0100
commit3004683f578e35693087832bde70e9e2ade33e0a (patch)
treee22fd47656a67a9570a898b242b876e57ffa63c3
parent6d31dab784c185864a115b390b3cd2f4d10a706f (diff)
downloadrabbitmq-server-bug26387.tar.gz
Work around Surstr?mming-addled ideas about how to report version numbers.bug26387
-rw-r--r--src/rabbit.erl3
-rw-r--r--src/rabbit_misc.erl17
-rw-r--r--src/rabbit_mnesia.erl4
3 files changed, 19 insertions, 5 deletions
diff --git a/src/rabbit.erl b/src/rabbit.erl
index a698e4ba..b8b21c10 100644
--- a/src/rabbit.erl
+++ b/src/rabbit.erl
@@ -487,9 +487,8 @@ rotate_logs(BinarySuffix) ->
start(normal, []) ->
case erts_version_check() of
ok ->
- {ok, Vsn} = application:get_key(rabbit, vsn),
rabbit_log:info("Starting RabbitMQ ~s on Erlang ~s~n~s~n~s~n",
- [Vsn, erlang:system_info(otp_release),
+ [rabbit_misc:version(), rabbit_misc:otp_release(),
?COPYRIGHT_MESSAGE, ?INFORMATION_MESSAGE]),
{ok, SupPid} = rabbit_sup:start_link(),
true = register(rabbit, self()),
diff --git a/src/rabbit_misc.erl b/src/rabbit_misc.erl
index a984d1f9..63f229be 100644
--- a/src/rabbit_misc.erl
+++ b/src/rabbit_misc.erl
@@ -59,7 +59,7 @@
-export([append_rpc_all_nodes/4]).
-export([os_cmd/1]).
-export([gb_sets_difference/2]).
--export([version/0, which_applications/0]).
+-export([version/0, otp_release/0, which_applications/0]).
-export([sequence_error/1]).
-export([json_encode/1, json_decode/1, json_to_term/1, term_to_json/1]).
-export([check_expiry/1]).
@@ -232,6 +232,7 @@
-spec(os_cmd/1 :: (string()) -> string()).
-spec(gb_sets_difference/2 :: (gb_sets:set(), gb_sets:set()) -> gb_sets:set()).
-spec(version/0 :: () -> string()).
+-spec(otp_release/0 :: () -> string()).
-spec(which_applications/0 :: () -> [{atom(), string(), string()}]).
-spec(sequence_error/1 :: ([({'error', any()} | any())])
-> {'error', any()} | any()).
@@ -917,6 +918,20 @@ version() ->
{ok, VSN} = application:get_key(rabbit, vsn),
VSN.
+%% See http://www.erlang.org/doc/system_principles/versions.html
+otp_release() ->
+ File = filename:join([code:root_dir(), "releases",
+ erlang:system_info(otp_release), "OTP_VERSION"]),
+ case file:read_file(File) of
+ {ok, VerBin} ->
+ %% 17.0 or later, we need the file for the minor version
+ string:strip(binary_to_list(VerBin), both, $\n);
+ {error, _} ->
+ %% R16B03 or earlier (no file, otp_release is correct)
+ %% or we couldn't read the file (so this is best we can do)
+ erlang:system_info(otp_release)
+ end.
+
%% application:which_applications(infinity) is dangerous, since it can
%% cause deadlocks on shutdown. So we have to use a timeout variant,
%% but w/o creating spurious timeout errors.
diff --git a/src/rabbit_mnesia.erl b/src/rabbit_mnesia.erl
index 880c30eb..2bada7ad 100644
--- a/src/rabbit_mnesia.erl
+++ b/src/rabbit_mnesia.erl
@@ -391,7 +391,7 @@ cluster_status(WhichNodes) ->
end.
node_info() ->
- {erlang:system_info(otp_release), rabbit_misc:version(),
+ {rabbit_misc:otp_release(), rabbit_misc:version(),
cluster_status_from_mnesia()}.
node_type() ->
@@ -764,7 +764,7 @@ version_error(Name, This, Remote) ->
"remote node ~s", [Name, This, Remote])}}.
check_otp_consistency(Remote) ->
- check_version_consistency(erlang:system_info(otp_release), Remote, "OTP").
+ check_version_consistency(rabbit_misc:otp_release(), Remote, "OTP").
check_rabbit_consistency(Remote) ->
check_version_consistency(