Ticket #3188 (closed defect: invalid)

Opened 6 years ago

Last modified 3 years ago

mc crashes on Solaris right after start

Reported by: drookie Owned by:
Priority: major Milestone:
Component: mc-core Version: 4.8.11
Keywords: Cc:
Blocked By: Blocking:
Branch state: no branch Votes for changeset:

Description (last modified by andrew_b) (diff)

mc crashes on Solaris 11.1 right after start. I've just built it, I've even had one successful session with it, but now it crashes. May be this has something to do with the fact that I changed the prompt.

OS: Solaris 11.1
GCC: 4.5.2
Comiler flags: -g -m64
Configure arguments: --prefix=/usr/local/mc --disable-dtrace
Shell: bash

Backtrace:

# gdb /usr/local/mc/bin/mc core
GNU gdb 6.8
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i386-pc-solaris2.11"...
Reading symbols from /usr/local/libiconv/lib/preloadable_libiconv.so...done.
Loaded symbols for /usr/local/libiconv/lib/preloadable_libiconv.so
Reading symbols from /usr/local/slang/lib/libslang.so.2...done.
Loaded symbols for /usr/local/slang/lib/libslang.so.2
Reading symbols from /usr/local/glib/lib/libgmodule-2.0.so.0...done.
Loaded symbols for /usr/local/glib/lib/libgmodule-2.0.so.0
Reading symbols from /usr/local/glib/lib/libglib-2.0.so.0...done.
Loaded symbols for /usr/local/glib/lib/libglib-2.0.so.0
Reading symbols from /lib/amd64/libpthread.so.1...
warning: Lowest section in /lib/amd64/libpthread.so.1 is .dynamic at 00000000000000b0
done.
Loaded symbols for /lib/64/libpthread.so.1
Reading symbols from /lib/amd64/libthread.so.1...
warning: Lowest section in /lib/amd64/libthread.so.1 is .dynamic at 00000000000000b0
done.
Loaded symbols for /lib/64/libthread.so.1
Reading symbols from /lib/amd64/libxnet.so.1...
warning: Lowest section in /lib/amd64/libxnet.so.1 is .dynamic at 00000000000000b0
done.
Loaded symbols for /lib/64/libxnet.so.1
Reading symbols from /lib/amd64/libc.so.1...done.
Loaded symbols for /lib/64/libc.so.1
Reading symbols from /usr/lib/amd64/libgcc_s.so.1...done.
Loaded symbols for /usr/lib/64/libgcc_s.so.1
Reading symbols from /lib/amd64/libdl.so.1...
warning: Lowest section in /lib/amd64/libdl.so.1 is .dynamic at 00000000000000b0
done.
Loaded symbols for /lib/64/libdl.so.1
Reading symbols from /lib/amd64/libm.so.2...done.
Loaded symbols for /lib/64/libm.so.2
Reading symbols from /lib/amd64/libsocket.so.1...done.
Loaded symbols for /lib/64/libsocket.so.1
Reading symbols from /lib/amd64/libnsl.so.1...done.
Loaded symbols for /lib/64/libnsl.so.1
Reading symbols from /usr/lib/locale/en_US.UTF-8/amd64/en_US.UTF-8.so.3...done.
Loaded symbols for /usr/lib/locale/en_US.UTF-8/amd64/en_US.UTF-8.so.3
Reading symbols from /usr/lib/locale/en_US.UTF-8/amd64/methods_unicode.so.3...done.
Loaded symbols for /usr/lib/locale/en_US.UTF-8/amd64/methods_unicode.so.3
Reading symbols from /lib/amd64/ld.so.1...done.
Loaded symbols for /lib/amd64/ld.so.1
Core was generated by `/usr/local/mc/bin/mc'.
Program terminated with signal 11, Segmentation fault.
[New process 68301    ]
#0  0xffff80ffbf4ca933 in iconv () from /lib/64/libc.so.1
(gdb) bt
#0  0xffff80ffbf4ca933 in iconv () from /lib/64/libc.so.1
#1  0xffff80ffbcfc0201 in g_iconv (converter=0x556c00, inbuf=0x0, inbytes_left=0x0, outbuf=0x0, outbytes_left=0x0)
    at gconvert.c:169
#2  0x00000000004a11ee in _str_convert (coder=0x556c00, string=0x51265c "~", size=1, buffer=0x5bb780) at strutil.c:83
#3  0x00000000004a14f1 in str_convert (coder=0x556c00, string=0x51265c "~", buffer=0x5bb780) at strutil.c:83
#4  0x00000000004a0677 in mc_config_normalize_before_save (value=0x51265c "~") at set.c:57
#5  0x00000000004a07d4 in mc_config_set_string (mc_config=0x5b7b60, group=0x5127ec "Midnight-Commander", 
    param=0x512644 "editor_backup_extension", value=0x51265c "~") at set.c:77
#6  0x0000000000474f96 in mc_config_get_string (mc_config=0x5b7b60, group=0x5127ec "Midnight-Commander", 
    param=0x512644 "editor_backup_extension", def=0x51265c "~") at get.c:69
#7  0x00000000004532a1 in load_setup () at setup.c:502
#8  0x000000000044d8f7 in main (argc=1, argv=0xffff80ffbffffb78) at main.c:130
(gdb) bt full
#0  0xffff80ffbf4ca933 in iconv () from /lib/64/libc.so.1
No symbol table info available.
#1  0xffff80ffbcfc0201 in g_iconv (converter=0x556c00, inbuf=0x0, inbytes_left=0x0, outbuf=0x0, outbytes_left=0x0)
    at gconvert.c:169
        cd = (iconv_t) 0x556c00
#2  0x00000000004a11ee in _str_convert (coder=0x556c00, string=0x51265c "~", size=1, buffer=0x5bb780) at strutil.c:83
        state = ESTR_SUCCESS
        left = 1
        bytes_read = 0
        bytes_written = 0
#3  0x00000000004a14f1 in str_convert (coder=0x556c00, string=0x51265c "~", buffer=0x5bb780) at strutil.c:83
No locals.
#4  0x00000000004a0677 in mc_config_normalize_before_save (value=0x51265c "~") at set.c:57
        conv = (GIConv) 0x556c00
        buffer = (GString *) 0x5bb780
        ok = 0
#5  0x00000000004a07d4 in mc_config_set_string (mc_config=0x5b7b60, group=0x5127ec "Midnight-Commander", 
    param=0x512644 "editor_backup_extension", value=0x51265c "~") at set.c:77
        buffer = (gchar *) 0x5b7b60 ""
#6  0x0000000000474f96 in mc_config_get_string (mc_config=0x5b7b60, group=0x5127ec "Midnight-Commander", 
    param=0x512644 "editor_backup_extension", def=0x51265c "~") at get.c:69
        conv = (GIConv) 0x5127ec
        buffer = (GString *) 0xffff80ffbf4bfb7c
        ret = (gchar *) 0x0
        conv_res = 4294934783
#7  0x00000000004532a1 in load_setup () at setup.c:502
        profile = 0x563a00 "/root/.config/mc/ini"
        i = 0
        buffer = 0xffff80ffbffffae0 "PШЪ©Ъ\200ЪЪВьD"
        kt = 0x0
#8  0x000000000044d8f7 in main (argc=1, argv=0xffff80ffbffffb78) at main.c:130
        error = (GError *) 0x0
        config_migrated = 0
        config_migrate_msg = 0x44d45b "H\203=Уc\016"
        exit_code = 1
(gdb) quit

Attachments

3188.patch (1.1 KB) - added by andrew_b 6 years ago.

Change History

comment:1 Changed 6 years ago by andrew_b

In POSIX.1-2001:

A third case is when inbuf is NULL or *inbuf is NULL, and outbuf is NULL or *outbuf is NULL. In this case, the iconv() function sets cd's conversion state to the initial state.

In Solaris:

For state-dependent encodings, the conversion descriptor cd is placed into its initial shift state by a call for which inbuf is a null pointer, or for which inbuf points to a null pointer. When iconv() is called in this way, and if outbuf is not a null pointer or a pointer to a null pointer, and outbytesleft points to a positive value, iconv() will place, into the output buffer, the byte sequence to change the output buffer to its initial shift state.

It looks like iconv (NULL, NULL, NULL, NULL) isn't supported in Solaris 11.1, i. e. outbuf shouldn't be NULL.

Last edited 6 years ago by andrew_b (previous) (diff)

Changed 6 years ago by andrew_b

comment:2 Changed 6 years ago by andrew_b

Please test the attached 3188.patch patch.

comment:3 Changed 6 years ago by drookie

Patch applied clearly, but mc is still crashing on start:

$ gdb src/mc-4.8.11/src/mc core
GNU gdb 6.8
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i386-pc-solaris2.11"...
Reading symbols from /usr/local/libiconv/lib/preloadable_libiconv.so...done.
Loaded symbols for /usr/local/libiconv/lib/preloadable_libiconv.so
Reading symbols from /usr/local/slang/lib/libslang.so.2...done.
Loaded symbols for /usr/local/slang/lib/libslang.so.2
Reading symbols from /usr/local/glib/lib/libgmodule-2.0.so.0...done.
Loaded symbols for /usr/local/glib/lib/libgmodule-2.0.so.0
Reading symbols from /usr/local/glib/lib/libglib-2.0.so.0...done.
Loaded symbols for /usr/local/glib/lib/libglib-2.0.so.0
Reading symbols from /lib/amd64/libpthread.so.1...
warning: Lowest section in /lib/amd64/libpthread.so.1 is .dynamic at 00000000000000b0
done.
Loaded symbols for /lib/64/libpthread.so.1
Reading symbols from /lib/amd64/libthread.so.1...
warning: Lowest section in /lib/amd64/libthread.so.1 is .dynamic at 00000000000000b0
done.
Loaded symbols for /lib/64/libthread.so.1
Reading symbols from /lib/amd64/libxnet.so.1...
warning: Lowest section in /lib/amd64/libxnet.so.1 is .dynamic at 00000000000000b0
done.
Loaded symbols for /lib/64/libxnet.so.1
Reading symbols from /lib/amd64/libc.so.1...done.
Loaded symbols for /lib/64/libc.so.1
Reading symbols from /usr/lib/amd64/libgcc_s.so.1...done.
Loaded symbols for /usr/lib/64/libgcc_s.so.1
Reading symbols from /lib/amd64/libdl.so.1...
warning: Lowest section in /lib/amd64/libdl.so.1 is .dynamic at 00000000000000b0
done.
Loaded symbols for /lib/64/libdl.so.1
Reading symbols from /lib/amd64/libm.so.2...done.
Loaded symbols for /lib/64/libm.so.2
Reading symbols from /lib/amd64/libsocket.so.1...done.
Loaded symbols for /lib/64/libsocket.so.1
Reading symbols from /lib/amd64/libnsl.so.1...done.
Loaded symbols for /lib/64/libnsl.so.1
Reading symbols from /usr/lib/locale/en_US.UTF-8/amd64/en_US.UTF-8.so.3...done.
Loaded symbols for /usr/lib/locale/en_US.UTF-8/amd64/en_US.UTF-8.so.3
Reading symbols from /usr/lib/locale/en_US.UTF-8/amd64/methods_unicode.so.3...done.
Loaded symbols for /usr/lib/locale/en_US.UTF-8/amd64/methods_unicode.so.3
Reading symbols from /lib/amd64/ld.so.1...done.
Loaded symbols for /lib/amd64/ld.so.1
Core was generated by `src/mc-4.8.11/src/mc'.
Program terminated with signal 11, Segmentation fault.
[New process 67897    ]
#0  0xffff80ffbf4ca933 in iconv () from /lib/64/libc.so.1
(gdb) bt
#0  0xffff80ffbf4ca933 in iconv () from /lib/64/libc.so.1
#1  0xffff80ffbcfc0201 in g_iconv (converter=0x556c80, inbuf=0x0, inbytes_left=0x0, outbuf=0xffff80ffbffff668, 
    outbytes_left=0xffff80ffbffff660) at gconvert.c:169
#2  0x00000000004a10f0 in str_iconv_init (coder=0x556c80) at strutil.c:80
#3  0x00000000004a127b in _str_convert (coder=0x556c80, string=0x5126bc "~", size=1, buffer=0x5bb780) at strutil.c:93
#4  0x00000000004a157e in str_convert (coder=0x556c80, string=0x5126bc "~", buffer=0x5bb780) at strutil.c:93
#5  0x00000000004a06d7 in mc_config_normalize_before_save (value=0x5126bc "~") at set.c:57
#6  0x00000000004a0834 in mc_config_set_string (mc_config=0x5b7ab0, group=0x51284c "Midnight-Commander", 
    param=0x5126a4 "editor_backup_extension", value=0x5126bc "~") at set.c:77
#7  0x0000000000474ff6 in mc_config_get_string (mc_config=0x5b7ab0, group=0x51284c "Midnight-Commander", 
    param=0x5126a4 "editor_backup_extension", def=0x5126bc "~") at get.c:69
#8  0x0000000000453301 in load_setup () at setup.c:502
#9  0x000000000044d957 in main (argc=1, argv=0xffff80ffbffff908) at main.c:130
(gdb) bt full
#0  0xffff80ffbf4ca933 in iconv () from /lib/64/libc.so.1
No symbol table info available.
#1  0xffff80ffbcfc0201 in g_iconv (converter=0x556c80, inbuf=0x0, inbytes_left=0x0, outbuf=0xffff80ffbffff668, 
    outbytes_left=0xffff80ffbffff660) at gconvert.c:169
        cd = (iconv_t) 0x556c80
#2  0x00000000004a10f0 in str_iconv_init (coder=0x556c80) at strutil.c:80
        obuf = (gchar *) 0x0
        oleft = 0
#3  0x00000000004a127b in _str_convert (coder=0x556c80, string=0x5126bc "~", size=1, buffer=0x5bb780) at strutil.c:93
        state = ESTR_SUCCESS
        left = 1
        bytes_read = 0
        bytes_written = 0
#4  0x00000000004a157e in str_convert (coder=0x556c80, string=0x5126bc "~", buffer=0x5bb780) at strutil.c:93
No locals.
#5  0x00000000004a06d7 in mc_config_normalize_before_save (value=0x5126bc "~") at set.c:57
        conv = (GIConv) 0x556c80
        buffer = (GString *) 0x5bb780
        ok = 0
#6  0x00000000004a0834 in mc_config_set_string (mc_config=0x5b7ab0, group=0x51284c "Midnight-Commander", 
    param=0x5126a4 "editor_backup_extension", value=0x5126bc "~") at set.c:77
        buffer = (gchar *) 0x5b7ab0 ""
#7  0x0000000000474ff6 in mc_config_get_string (mc_config=0x5b7ab0, group=0x51284c "Midnight-Commander", 
    param=0x5126a4 "editor_backup_extension", def=0x5126bc "~") at get.c:69
        conv = (GIConv) 0x51284c
        buffer = (GString *) 0xffff80ffbf4bfb7c
        ret = (gchar *) 0x0
        conv_res = 4294934783
#8  0x0000000000453301 in load_setup () at setup.c:502
        profile = 0x563a90 "/home/emz/.config/mc/ini"
        i = 0
        buffer = 0xffff80ffbffff870 "ЮЬЪ©Ъ\200ЪЪWыD"
        kt = 0x0
#9  0x000000000044d957 in main (argc=1, argv=0xffff80ffbffff908) at main.c:130
        error = (GError *) 0x0
        config_migrated = 0
        config_migrate_msg = 0x44d4bb "H\203=Уc\016"
        exit_code = 1
(gdb)
Last edited 3 years ago by andrew_b (previous) (diff)

comment:4 Changed 6 years ago by drookie

Looks like this change is triggered by some SRU, because I have mc working on a non-patched 11.1. Target machine with crashing mc is SRU 17.5. Anyway on Solaris 11.2 this will be incorporated in the point-release, triggering this change on all newly-installed instances.

comment:5 Changed 6 years ago by slavazanko

I found some tips about Solaris and iconv stuff:
https://developer.gnome.org/glib/2.37/glib-building.html

Just search by 'GLib depends on a number of other libraries' text on the page and check all iconv-related dependencies.

I don't know will it be helpful for you or not, but in any way we don't have ability to reproduce the bug. I hope that the bug is related to libraries environment, not to implementation of iconv-stuff in mc.

comment:6 Changed 6 years ago by drookie

Thanks for noticing, I've rebuilt local glib with local GNU libiconv and mc started to work.
But, anyway, on older Solaris versions this was working even with system iconv(). And I still think that getting with to work with local iconv() is the idea.

Anyway, thanks for your work.

comment:7 Changed 3 years ago by andrew_b

  • Description modified (diff)

comment:8 Changed 3 years ago by andrew_b

  • Status changed from new to closed
  • Resolution set to invalid
  • Milestone Future Releases deleted
Note: See TracTickets for help on using tickets.