File 0926-erts-Fix-cerl-to-better-handle-multiple-type-argumen.patch of Package erlang
From cd7cb27c0b61373de73df0971a845f3fa18fdb14 Mon Sep 17 00:00:00 2001
From: Lukas Larsson <lukas@erlang.org>
Date: Tue, 1 Feb 2022 13:21:25 +0100
Subject: [PATCH 3/3] erts: Fix cerl to better handle multiple type arguments
When `ERL_AFLAGS="-emu_type debug" cerl -debug` is called,
cerl incorrectly tried to run beam.debug.debug.smp which does
not exist. This commit fixes so that multiple debug type
indications are merged as they should be.
---
erts/etc/unix/cerl.src | 34 +++++++++++++++++++---------------
1 file changed, 19 insertions(+), 15 deletions(-)
diff --git a/erts/etc/unix/cerl.src b/erts/etc/unix/cerl.src
index 85396e3d81..6ce3bd5111 100644
--- a/erts/etc/unix/cerl.src
+++ b/erts/etc/unix/cerl.src
@@ -136,27 +136,27 @@ while [ $# -gt 0 ]; do
"-lcnt")
shift
cargs="$cargs -lcnt"
- TYPE=.lcnt
+ TYPE=lcnt
;;
"-gprof")
shift
cargs="$cargs -gprof"
- TYPE=.gprof
+ TYPE=gprof
;;
"-debug")
shift
cargs="$cargs -debug"
- TYPE=.debug
+ TYPE=debug
;;
"-frmptr")
shift
cargs="$cargs -frmptr"
- TYPE=.frmptr
+ TYPE=frmptr
;;
"-icount")
shift
cargs="$cargs -icount"
- TYPE=.icount
+ TYPE=icount
;;
"-dump")
shift
@@ -201,12 +201,12 @@ while [ $# -gt 0 ]; do
"-gcov")
shift
cargs="$cargs -gcov"
- TYPE=.gcov
+ TYPE=gcov
;;
"-valgrind")
shift
cargs="$cargs -valgrind"
- TYPE=.valgrind
+ TYPE=valgrind
run_valgrind=yes
skip_erlexec=yes
;;
@@ -225,12 +225,12 @@ while [ $# -gt 0 ]; do
shift
cargs="$cargs -asan"
run_asan=yes
- TYPE=.asan
+ TYPE=asan
;;
"-emu_type")
shift
cargs="$cargs -$1"
- TYPE=.$1
+ TYPE=$1
shift
;;
"-rr")
@@ -262,8 +262,12 @@ PATH=$BINDIR:$ROOTDIR/bin:$PATH
EXEC=$BINDIR/erlexec
PROGNAME="$PROGNAME$cargs"
-EMU="$EMU$TYPE"
-EMU_NAME=`$EXEC -emu_name_exit`
+EMU_NAME_ARGS=""
+if [ "x$TYPE" != "x" ]; then
+ EMU_NAME_ARGS="${EMU_NAME_ARGS} -emu_type ${TYPE}"
+ set -- -emu_type ${TYPE} ${1+"$@"}
+fi
+EMU_NAME=`$EXEC -emu_name_exit ${EMU_NAME_ARGS}`
if [ $skip_erlexec = yes ]; then
emu_xargs=`echo $xargs | sed "s|+|-|g"`
--
2.34.1