{"action":"closed","issue":{"url":"https://api.github.com/repos/CloudI/CloudI/issues/216","repository_url":"https://api.github.com/repos/CloudI/CloudI","labels_url":"https://api.github.com/repos/CloudI/CloudI/issues/216/labels{/name}","comments_url":"https://api.github.com/repos/CloudI/CloudI/issues/216/comments","events_url":"https://api.github.com/repos/CloudI/CloudI/issues/216/events","html_url":"https://github.com/CloudI/CloudI/issues/216","id":366711398,"node_id":"MDU6SXNzdWUzNjY3MTEzOTg=","number":216,"title":"configure script fails to detect Erlang version on Alpine Linux aarch64 due to shell expands $-","user":{"login":"ncopa","id":66357,"node_id":"MDQ6VXNlcjY2MzU3","avatar_url":"https://avatars1.githubusercontent.com/u/66357?v=4","gravatar_id":"","url":"https://api.github.com/users/ncopa","html_url":"https://github.com/ncopa","followers_url":"https://api.github.com/users/ncopa/followers","following_url":"https://api.github.com/users/ncopa/following{/other_user}","gists_url":"https://api.github.com/users/ncopa/gists{/gist_id}","starred_url":"https://api.github.com/users/ncopa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ncopa/subscriptions","organizations_url":"https://api.github.com/users/ncopa/orgs","repos_url":"https://api.github.com/users/ncopa/repos","events_url":"https://api.github.com/users/ncopa/events{/privacy}","received_events_url":"https://api.github.com/users/ncopa/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-10-04T09:58:30Z","updated_at":"2018-10-04T16:17:24Z","closed_at":"2018-10-04T16:17:24Z","author_association":"NONE","body":"Alpine Linux aarch64 builder fails to detect Erlang version:\r\n````\r\n...\r\nchecking for erl... /usr/bin/erl\r\nchecking for Erlang >= 19.3... configure: error: in `/home/buildozer/aports/community/cloudi/src/cloudi-1.7.4/src':\r\nconfigure: error: test Erlang program execution failed\r\nSee `config.log' for more details\r\n````\r\n\r\nThe config log reveals that the Erlang code is generated wrongly:\r\n````\r\n...\r\nconfigure:23009: checking for Erlang >= 19.3\r\nconfigure:23099: $ERLC $ERLCFLAGS -b beam conftest.$ac_ext >&5 && echo \"#!/bin/s\r\nh\" > conftest$ac_exeext && $as_echo \"\\\"$ERL\\\" -run conftest start -run init stop\r\n -noshell\" >> conftest$ac_exeext && chmod +x conftest$ac_exeext\r\nconftest.erl:16: syntax error before: 'end'\r\nconftest.erl:2: function start/0 undefined\r\nconfigure:23099: $? = 1\r\nconfigure: program exited with status 1\r\nconfigure: failed program was:\r\n| -module(conftest).\r\n| -export([start/0]).\r\n| \r\n| start() ->\r\n| \r\n|             Version = case erlang:system_info(otp_release) of\r\n|                 [$R, Major1, Major2, T1 | MinorT] ->\r\n|                     %% before 17.0\r\n|                     Minor = if\r\n|                         MinorT == [] ->\r\n|                             0;\r\n|                         true ->\r\n|                             %% Remove -1 from R16B03-1\r\n|                             list_to_integer(lists:takewhile(fun(C) ->\r\n|                                 C /= \r\n|                             end, MinorT))\r\n|                     end,\r\n|                     if\r\n|                         T1 == $B ->\r\n|                             list_to_integer([Major1, Major2]) * 1000000 +\r\n|                             Minor * 1000 + 999;\r\n|                         T1 == $A ->\r\n|                             list_to_integer([Major1, Major2]) * 1000000 +\r\n|                             Minor * 1000\r\n|                     end;\r\n...\r\n````\r\n\r\nNote that line 16 it refers to has:\r\n````erlang\r\n                             list_to_integer(lists:takewhile(fun(C) ->\r\n                                 C /= \r\n                             end, MinorT))\r\n````\r\nwhen it should be:\r\n````erlang\r\n                             list_to_integer(lists:takewhile(fun(C) ->\r\n                                 C /= $-\r\n                             end, MinorT))\r\n````\r\n\r\nThis is because the shell [expands](http://pubs.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html#tag_02_05_02) `$-` to the shell's current options flags. I believe this expansion is not intentional.\r\n\r\nFix is trivial:\r\n````diff\r\n--- a/src/m4/ax_erlang_otp_version.m4\r\n+++ b/src/m4/ax_erlang_otp_version.m4\r\n@@ -168,7 +168,7 @@ AC_DEFUN([AX_ERLANG_REQUIRE_OTP_VER],\r\n                         true ->\r\n                             %% Remove -1 from R16B03-1\r\n                             list_to_integer(lists:takewhile(fun(C) ->\r\n-                                C /= $-\r\n+                                C /= \\$-\r\n                             end, MinorT))\r\n                     end,\r\n                     if\r\n````"}}
{"actor":{"display_login":"okeuday"}}