File 0577-Clarify-beam_load-error-message-on-file-module-misma.patch of Package erlang
From 0e6fdc32a1e66405faa08eb79fbc3e05e6fa0cf0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jos=C3=A9=20Valim?= <jose.valim@plataformatec.com.br>
Date: Sat, 8 Sep 2018 10:23:49 -0700
Subject: [PATCH] Clarify beam_load error message on file/module mismatch
This is particularly important in case insensitive filesystems,
where attempting to invoke a module with the wrong case leads
to confusing error messages:
1> erlpress_core:foo().
beam/beam_load.c(1428): Error loading module 'erlpress_core':
module name in object code is erlPress_core
Loading of erlPress_core.beam failed: :badfile
This commit replaces object code by BEAM file and improves
the readability of the message.
---
erts/emulator/beam/beam_load.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/erts/emulator/beam/beam_load.c b/erts/emulator/beam/beam_load.c
index 50cbb37f3e..d8cf3fb8e2 100644
--- a/erts/emulator/beam/beam_load.c
+++ b/erts/emulator/beam/beam_load.c
@@ -1373,7 +1373,7 @@ load_atom_table(LoaderState* stp, ErtsAtomEncoding enc)
ap = atom_tab(atom_val(stp->atom[1]));
memcpy(sbuf, ap->name, ap->len);
sbuf[ap->len] = '\0';
- LoadError1(stp, "module name in object code is %s", sbuf);
+ LoadError1(stp, "BEAM file exists but it defines a module named %s", sbuf);
}
return 1;
--
2.16.4