[Mono-bugs] [Bug 473131] New: System.Diagnostic.ProcModule.FileName truncates the file name if it is too long

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Thu Feb 5 19:39:56 EST 2009


https://bugzilla.novell.com/show_bug.cgi?id=473131


           Summary: System.Diagnostic.ProcModule.FileName truncates the
                    file name if it is too long
    Classification: Mono
           Product: Mono: Class Libraries
           Version: 2.0.x
          Platform: x86
        OS/Version: Linux
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: System
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: ice1n36 at gmail.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---


Created an attachment (id=270649)
 --> (https://bugzilla.novell.com/attachment.cgi?id=270649)
Repro case

Description of Problem:
When using System.Diagnostic.ProcModule.FileName to get the absolute path of
the modules, if the path is more than 131 characters long, it will truncate it.

Steps to reproduce the problem:
1. Unzip MonoBug.7z
2. Follow ReadMe.txt inside unzipped folder


Actual Results:
Running on OpenSUSE 11.0:

linux at linux:~/testprograms/MonoSystemDiagnosticBug/ReallyReallyReallyReallyReallyReallyReallyReallyReallyLongLongDirectoryName>
mono MonoProcModuleFileNameBug.exe 

+-------------------------------------------------------------------------------------+

File Name from ProcModule:
/home/linux/testprograms/MonoSystemDiagnosticBug/ReallyReallyReallyReallyReallyReallyReallyReallyReallyLongLongDirectoryName/MonoP錬࠯槿Ǒ

File Name from Assembly:  
/home/linux/testprograms/MonoSystemDiagnosticBug/ReallyReallyReallyReallyReallyReallyReallyReallyReallyLongLongDirectoryName/MonoProcModuleFileNameBugexe

+-------------------------------------------------------------------------------------+

.. (More unnecessary output)

Running on MVL (Monta Vista Linux) 5.0:

tngo@(none):~/MonoSystemDiagnosticBug/ReallyReallyReallyReallyReallyReallyReallyReallyReallyLongLongDirectoryName$
mono MonoProcModuleFileNameBug.exe 
+-------------------------------------------------------------------------------------+
File Name from ProcModule:
/home/tngo/MonoSystemDiagnosticBug/ReallyReallyReallyReallyReallyReallyReallyReallyReallyLongLongDirectoryName/MonoProcModuleFileN??
File Name from Assembly:  
/home/tngo/MonoSystemDiagnosticBug/ReallyReallyReallyReallyReallyReallyReallyReallyReallyLongLongDirectoryName/MonoProcModuleFileNameBug.exe
+-------------------------------------------------------------------------------------+

.. (More unnecessary output)

Expected Results:

Expected for OpenSUSE 11.0:


linux at linux:~/testprograms/MonoSystemDiagnosticBug/ReallyReallyReallyReallyReallyReallyReallyReallyReallyLongLongDirectoryName>
mono MonoProcModuleFileNameBug.exe 

+-------------------------------------------------------------------------------------+

File Name from ProcModule:
/home/linux/testprograms/MonoSystemDiagnosticBug/ReallyReallyReallyReallyReallyReallyReallyReallyReallyLongLongDirectoryName/MonoProcModuleFileNameBugexe

File Name from Assembly:  
/home/linux/testprograms/MonoSystemDiagnosticBug/ReallyReallyReallyReallyReallyReallyReallyReallyReallyLongLongDirectoryName/MonoProcModuleFileNameBugexe

+-------------------------------------------------------------------------------------+

Expected for MVL (Monta Vista Linux) 5.0:

tngo@(none):~/MonoSystemDiagnosticBug/ReallyReallyReallyReallyReallyReallyReallyReallyReallyLongLongDirectoryName$
mono MonoProcModuleFileNameBug.exe 
+-------------------------------------------------------------------------------------+
File Name from ProcModule:
/home/tngo/MonoSystemDiagnosticBug/ReallyReallyReallyReallyReallyReallyReallyReallyReallyLongLongDirectoryName/MonoProcModuleFileNameBug.exe
File Name from Assembly:  
/home/tngo/MonoSystemDiagnosticBug/ReallyReallyReallyReallyReallyReallyReallyReallyReallyLongLongDirectoryName/MonoProcModuleFileNameBug.exe
+-------------------------------------------------------------------------------------+

On .NET Windows, it works totally fine, running on top of Mono or Microsoft
NET CLR.


How often does this happen? 

Happens all the time.  It looks like some sort of buffer overflow, because
sometimes it crashes like this:

tngo@(none):~/MonoSystemDiagnosticBug/ReallyReallyReallyReallyReallyReallyReallyReallyReallyLongLongDirectoryName$
mono MonoProcModuleFileNameBug.exe 

** ERROR **: file strenc.c: line 182 (mono_unicode_to_external): assertion
failed: (utf8!=NULL)
aborting...
Stacktrace:

  at (wrapper managed-to-native) System.Diagnostics.Process.GetModules_internal
(intptr) <0x00004>
  at (wrapper managed-to-native) System.Diagnostics.Process.GetModules_internal
(intptr) <0xffffffff>
  at System.Diagnostics.Process.get_Modules () <0x00020>
  at (wrapper remoting-invoke-with-check)
System.Diagnostics.Process.get_Modules () <0xffffffff>
  at MonoProcModuleFileNameBug.Program.Main (string[]) <0x0002f>
  at (wrapper runtime-invoke)
MonoProcModuleFileNameBug.Program.runtime_invoke_void_string[]
(object,intptr,intptr,intptr) <0xffffffff>

Native stacktrace:

        mono [0x806b2e3]
        [0xb7eee440]
        /lib/libc.so.6(abort+0x107) [0xb7d297c7]
        /usr/lib/libglib-2.0.so.0 [0xb7e93fab]
        /usr/lib/libglib-2.0.so.0(g_log+0x1e) [0xb7e93fce]
        /usr/lib/libglib-2.0.so.0(g_assert_warning+0x53) [0xb7e94033]
        mono [0x814d24b]
        mono [0x81b4cfe]
        mono [0x81b4eeb]
        mono [0x81ac86a]
        mono [0x81acf26]
        [0xb7a5d95a]
        [0xb7a5d8b9]
        [0xb7a5d85f]
        [0xb7a5d248]
        [0xb7a5d1b3]
        mono(mono_runtime_exec_main+0xc9) [0x80fd4a9]
        mono(mono_runtime_run_main+0x170) [0x80fe780]
        mono(mono_main+0x1290) [0x805a9b0]
        mono [0x80591bd]
        /lib/libc.so.6(__libc_start_main+0xd0) [0xb7d15f80]
        mono [0x8059111]
Failed to read a valid object file image from memory.

Debug info from gdb:

Using host libthread_db library "/lib/libthread_db.so.1".
0xb7db2f02 in syscall () from /lib/libc.so.6

=================================================================
Got a SIGABRT while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries 
used by your application.
=================================================================


Additional Information:

Attached below will be the entire output of the executed programs on:

1. Mono on OpenSUSE 11.0
2. Mono on MVL 5.0
3. Mono on Windows XP 32
4. Microsoft .NET CLR on Windows XP 32

-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list