Bug 319579 (MONO76756) - Runtime crash with assemblies having same basename (a.exe and a.dll, where a.exe links against a.dll)
Summary: Runtime crash with assemblies having same basename (a.exe and a.dll, where a....
Status: RESOLVED MOVED
Alias: MONO76756
Product: Mono: Runtime
Classification: Mono
Component: JIT (show other bugs)
Version: 1.1
Hardware: Other Other
: P3 - Medium : Normal
Target Milestone: ---
Assignee: Paolo Molaro
QA Contact: Mono Bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-11-19 01:19 UTC by Aaron Bockover
Modified: 2007-09-15 21:24 UTC (History)
0 users

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments
Tarball containing three files necessary to reproduce (615 bytes, application/octet-stream)
2005-11-19 01:22 UTC, Thomas Wiest
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Wiest 2007-09-15 19:38:37 UTC


---- Reported by abockover@novell.com 2005-11-18 18:19:58 MST ----

If two assemblies have the same basename (a.exe and a.dll, a is the
basename), and a.exe links against a.dll, the runtime will crash when a.exe
instantiates a class in a.dll.

Two things happen, depending on how the invoked class is assigned. 

If the instantiation is assigned to a local variable (B b = new B()), the
runtime will SIGSEGV with the following trace:

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 1076079520 (LWP 30973)]
mono_class_from_mono_type (type=0x98) at class.c:2970
2970    class.c: No such file or directory.
        in class.c
(gdb) bt
#0  mono_class_from_mono_type (type=0x98) at class.c:2970
#1  0x0810ea91 in mono_compile_create_var (cfg=0x81f7650, type=0x98,
    opcode=152) at mini.c:1581
#2  0x0812b687 in mini_method_compile (method=0x81f6f90, opts=92555,
    domain=0x21f00, run_cctors=152, compile_aot=152, parts=0) at mini.c:8506
#3  0x0812c33b in mono_jit_compile_method_with_opt (
    method=<value optimized out>, opt=<value optimized out>) at mini.c:9563
#4  0x0812c6d3 in mono_jit_runtime_invoke (method=0x81f6f90, obj=0x0,
    params=0xbffbd0a8, exc=0x0) at mini.c:9771
#5  0x080cb402 in mono_runtime_exec_main (method=0x81f6f90, args=0x2ae10,
    exc=0x0) at object.c:2039
#6  0x080cdd2e in mono_runtime_run_main (method=0x81f6f90, argc=0,
    argv=0xbffbd348, exc=0x0) at object.c:1897
#7  0x0805d4c2 in mono_main (argc=1, argv=0xbffbd344) at driver.c:533
#8  0x4012fea0 in __libc_start_main () from /lib/tls/libc.so.6
#9  0x0805bf81 in _start () at start.S:119

If the instantiation is not assigned (new B()), the runtime instead will
exit with a warning:

** (a.exe:31033): WARNING **: Missing method .ctor in assembly
/home/aaron/Desktop/assembly-basename-bug/a.exe, type B

** ERROR **: file mini.c: line 9575 (mono_jit_compile_method_inner): should
not be reached
aborting...

I think this warning gives a clue... shouldn't it be looking for type B in
a.dll, not a.exe?

I found this bug today when I started to resume work on hal-sharp. My last
commit was in mid/early July of this year. The library was "hal-sharp.dll"
and I had a test program named "hal-sharp.exe". Whatever the latest mono
was in July did not have this problem.



---- Additional Comments From abockover@novell.com 2005-11-18 18:22:13 MST ----

Created an attachment (id=168836)
Tarball containing three files necessary to reproduce




---- Additional Comments From abockover@novell.com 2005-11-18 18:23:53 MST ----

Regarding the attachment, the tarball contains three files:

A.cs: used to build a.exe, and instantiates class B from a.dll
B.cs: contains B class, used to build a.dll
Makefile: build the two assemblies

make && make run

... Will show the crash. Read the A.cs and Makefile for more info



---- Additional Comments From vargaz@gmail.com 2005-11-18 18:30:29 MST ----



*** This bug has been marked as a duplicate of https://bugzilla.novell.com/show_bug.cgi?id=MONO74982 ***

Imported an attachment (id=168836)

Unknown bug field "cf_op_sys_details" encountered while moving bug
   <cf_op_sys_details>SUSE 10.0</cf_op_sys_details>
Unknown operating system other. Setting to default OS "Other".
This bug was marked DUPLICATE in the database it was moved from.
    Changing resolution to "MOVED"