-
Notifications
You must be signed in to change notification settings - Fork 521
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
OTP 23 [master] compatibility #2191
OTP 23 [master] compatibility #2191
Conversation
Switching to uri_string as the warning suggest would ruin OTP 20 compatibility.
See [1] for context. 1. https://bugs.erlang.org/browse/ERL-1113
Switching to uri_string as the warning suggest would ruin OTP 20 compatibility.
Nice, thanks. And hah, yea, I guess you have to wrap the compile directive in a |
The new module to use is |
For OTP 19 and earlier compatibility.
@tsloughter yup, an |
CI is green now 👌 |
Yea, a better change would be to create new functions that wrap |
Thanks. I'll merge this. I'm looking to get a release out today but want to replace this change with use of |
@tsloughter I'd be happy to do it. Thank you for the quick release! |
@tsloughter so I tried and it turns out to be less trivial than it sounds. Getting rid of %%% @doc multi-OTP version compatibility shim for working with URIs
-module(rebar_uri).
-ifdef (OTP_RELEASE).
-export([parse/1]).
-spec parse(URIString) -> URIMap when
URIString :: uri_string:uri_string(),
URIMap :: uri_string:uri_map() | uri_string:error().
parse(URIString) ->
uri_string:parse(URIString).
-else.
-export([parse/1]).
-spec parse(URIString) -> URIMap when
URIString :: iodata(),
URIMap :: map() | {error, atom(), term()}.
parse(URIString) ->
case http_uri:parse(URIString) of
{error, Reason} ->
%% no additional parser/term info available to us,
%% e.g. see what uri_string returns in
%% uri_string:parse(<<"h$ttp:::://////lolz">>).
{error, Reason, ""};
{ok, {Scheme, UserInfo, Host, Port, Path, Query}} ->
#{
scheme => Scheme,
host => Host,
port => Port,
path => Path,
%% http_uri:parse/1 includes the leading question mark
%% in query string but uri_string:parse/1 leaves it out
query => string:slice(Query, 1),
userinfo => UserInfo
}
end.
-endif. but there is no replacement for So if you have a clear idea of how to approach this, go ahead and do it. |
Options:
|
@starbelly thanks. Reimplementing I'd also question the need for OTP 18 and 19 support in almost 2020 but OTP 20 is also affected (doesn't ship |
Alternatively |
Isn't |
@tsloughter it will encode URI segments but it requires at least a scheme, hostname, and a path to be in the map. So it would be a breaking change to |
@michaelklishin I think the best option is to patch |
#2195 is ready for QA. |
@michaelklishin Second thought... we are going to have to re-vendor hex_core anyway, so let's get a patch to hex_core done and then I'll do a PR to re-sync hex_core in rebar3. Are you going to open a PR to hex_core? If not, I can certainly do so based on your code. |
which has been deprecated in OTP 23 [master]. See erlang/rebar32195 and erlang/rebar3#2191 for background.
Team RabbitMQ tests OTP versions from 20.3 to master in our CI/CD pipelines. Recent OTP master changes introduce additional warnings that make Rebar bootstrap fail.
Unfortunately, there is no URI utility function module that's both available in OTP 20 and not deprecated in OTP 23. So this PR suppresses a few warnings for now. I hope that's acceptable.