Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 729964 - dev-lang/elixir merge failure - makefile error (possibly due to /bin/sh -> mksh)
Summary: dev-lang/elixir merge failure - makefile error (possibly due to /bin/sh -> mksh)
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: AMD64 Linux
: Normal normal
Assignee: Mikhail S. Pobolovets
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-06-28 01:21 UTC by Maciej Barć
Modified: 2020-12-13 13:00 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
build log (build.log,9.65 KB, text/x-log)
2020-06-28 01:21 UTC, Maciej Barć
Details
system info (info,7.21 KB, text/plain)
2020-06-28 19:26 UTC, Maciej Barć
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Maciej Barć gentoo-dev 2020-06-28 01:21:34 UTC
Created attachment 646896 [details]
build log

Elixir fails to merge for me

/usr/bin/install: cannot stat 'lib/eex/ebin/*': No such file or directory
/usr/bin/install: cannot stat 'lib/ex_unit/ebin/*': No such file or directory
/usr/bin/install: cannot stat 'lib/iex/ebin/*': No such file or directory
/usr/bin/install: cannot stat 'lib/logger/ebin/*': No such file or directory
/usr/bin/install: cannot stat 'lib/mix/ebin/*': No such file or directory
make: *** [Makefile:117: install] Error 1
Comment 1 Maciej Barć gentoo-dev 2020-06-28 19:26:20 UTC
Created attachment 646996 [details]
system info

emerge --info
Comment 2 Sergei Trofimovich (RETIRED) gentoo-dev 2020-06-28 19:36:31 UTC
'install' phase looks quite a different from by system. I suspect it's a result of non-bash shell:

> sh mksh 57-r2

elixir might need to be adapted to it (or force SHELL=/bin/bash). Will set up a chroot with mksh locally and experiment.
Comment 3 Maciej Barć gentoo-dev 2020-06-28 19:38:47 UTC
Switched my shell to bash as Sergei (slyfox) suggested on IRC.
Elixir merged successfully.
Comment 4 Sergei Trofimovich (RETIRED) gentoo-dev 2020-06-28 21:37:56 UTC
The problem is at least in the shell wrappers that run elixir. This is suppsoed to run a compiler for a while:

"""
sf /var/tmp/portage/dev-lang/elixir-1.10.3/work/elixir-1.10.3 # time bin/elixirc --verbose --ignore-module-conflict  lib/elixir/unicode/unicode.ex -o lib/elixir/ebin

real	0m0,008s
user	0m0,004s
sys	0m0,005s
"""

Instead it returns instantly and does nothing.
Comment 5 Sergei Trofimovich (RETIRED) gentoo-dev 2020-06-28 21:41:51 UTC
Going deeper: compare mksh and bash environments:

"""
sf /var/tmp/portage/dev-lang/elixir-1.10.3/work/elixir-1.10.3 # time mksh -x bin/elixirc --verbose --ignore-module-conflict  lib/elixir/unicode/unicode.ex -o lib/elixir/ebin
+ mksh -x bin/elixirc --verbose --ignore-module-conflict lib/elixir/unicode/unicode.ex -o lib/elixir/ebin
+ set -e
+ '[' 5 -eq 0 ']'
+ '[' --verbose '=' --help ']'
+ '[' --verbose '=' -h ']'
+ readlink_f bin/elixirc
+ dirname bin/elixirc
+ >/dev/null
+ cd bin
+ basename bin/elixirc
+ filename=elixirc
+ '[' -h elixirc ']'
+ pwd -P
+ echo /var/tmp/portage/dev-lang/elixir-1.10.3/work/elixir-1.10.3/bin/elixirc
+ SELF=/var/tmp/portage/dev-lang/elixir-1.10.3/work/elixir-1.10.3/bin/elixirc
+ dirname /var/tmp/portage/dev-lang/elixir-1.10.3/work/elixir-1.10.3/bin/elixirc
+ SCRIPT_PATH=/var/tmp/portage/dev-lang/elixir-1.10.3/work/elixir-1.10.3/bin
+ /var/tmp/portage/dev-lang/elixir-1.10.3/work/elixir-1.10.3/bin/elixir +elixirc --verbose --ignore-module-conflict lib/elixir/unicode/unicode.ex -o lib/elixir/ebin

real	0m0,012s
user	0m0,006s
sys	0m0,006s
"""

"""
time bash -x bin/elixirc --verbose --ignore-module-conflict  lib/elixir/unicode/unicode.ex -o lib/elixir/ebin
+ set -e
+ '[' 5 -eq 0 ']'
+ '[' --verbose = --help ']'
+ '[' --verbose = -h ']'
++ readlink_f bin/elixirc
+++ dirname bin/elixirc
++ cd bin
+++ basename bin/elixirc
++ filename=elixirc
++ '[' -h elixirc ']'
+++ pwd -P
++ echo /tmp/portage/dev-lang/elixir-1.10.3/work/elixir-1.10.3/bin/elixirc
+ SELF=/tmp/portage/dev-lang/elixir-1.10.3/work/elixir-1.10.3/bin/elixirc
++ dirname /tmp/portage/dev-lang/elixir-1.10.3/work/elixir-1.10.3/bin/elixirc
+ SCRIPT_PATH=/tmp/portage/dev-lang/elixir-1.10.3/work/elixir-1.10.3/bin
+ exec /tmp/portage/dev-lang/elixir-1.10.3/work/elixir-1.10.3/bin/elixir +elixirc --verbose --ignore-module-conflict lib/elixir/unicode/unicode.ex -o lib/elixir/ebin
Compiling /tmp/portage/dev-lang/elixir-1.10.3/work/elixir-1.10.3/lib/elixir/unicode/unicode.ex (it's taking more than 15s)

real	0m21,590s
user	0m20,916s
sys	0m2,010s
"""
Comment 6 Haelwenn (lanodan) Monnier 2020-12-09 15:33:46 UTC
I found the reason why, it lies in bin/elixir.

`erl` (from Erlang) is overridden by a shell function:
- `exec erl` seems interpreted by bash as "launch the executable erl"
- `exec erl` seems interpreted by mksh as "launch the erl command, which resolves to the erl function"

I messaged the mksh IRC channel about it, it seems like both are misbehaving according to POSIX: "If command is found, but it is not an executable utility, the exit status shall be 126."
Comment 7 Haelwenn (lanodan) Monnier 2020-12-09 17:32:38 UTC
(In reply to Haelwenn Monnier from comment #6)
> I found the reason why, it lies in bin/elixir.
> 
> `erl` (from Erlang) is overridden by a shell function:
> - `exec erl` seems interpreted by bash as "launch the executable erl"
> - `exec erl` seems interpreted by mksh as "launch the erl command, which
> resolves to the erl function"
> 
> I messaged the mksh IRC channel about it, it seems like both are misbehaving
> according to POSIX: "If command is found, but it is not an executable
> utility, the exit status shall be 126."

I submitted https://github.com/elixir-lang/elixir/pull/10557 as a fix for it, should I do a PR/git-send-email for the ebuild when it is accepted from elixir?
Comment 8 Sergei Trofimovich (RETIRED) gentoo-dev 2020-12-13 12:51:10 UTC
Thanks for tracking it down and fixing upstream! I'll pull the patch in once basic test passes.

Next time feel free to send a patch any way you see most convenient for you.
Comment 9 Larry the Git Cow gentoo-dev 2020-12-13 13:00:46 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8b417be714a45559a9c29eec3c13c600cedff0f2

commit 8b417be714a45559a9c29eec3c13c600cedff0f2
Author:     Sergei Trofimovich <slyfox@gentoo.org>
AuthorDate: 2020-12-13 12:52:32 +0000
Commit:     Sergei Trofimovich <slyfox@gentoo.org>
CommitDate: 2020-12-13 13:00:44 +0000

    dev-lang/elixir: backport mksh fix
    
    Reported-by: Maciej Barć
    Fixed-by: Haelwenn Monnier
    Closes: https://bugs.gentoo.org/729964
    Package-Manager: Portage-3.0.12, Repoman-3.0.2
    Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>

 dev-lang/elixir/elixir-1.11.2.ebuild           |  1 +
 dev-lang/elixir/files/elixir-1.11.2-mksh.patch | 81 ++++++++++++++++++++++++++
 2 files changed, 82 insertions(+)