Bug 4256 - testparm stalls if LC_ALL=ru_RU.koi8r, or trips assert in glibc if LC_ALL is unset or set to C
Summary: testparm stalls if LC_ALL=ru_RU.koi8r, or trips assert in glibc if LC_ALL is ...
Status: RESOLVED WORKSFORME
Alias: None
Product: Samba 3.0
Classification: Unclassified
Component: Client Tools (show other bugs)
Version: 3.0.23d
Hardware: Other Linux
: P3 normal
Target Milestone: none
Assignee: Samba Bugzilla Account
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-11-26 16:55 UTC by Denis Vlasenko
Modified: 2019-02-12 23:46 UTC (History)
0 users

See Also:


Attachments
Patch which adds debugging prints (7.44 KB, patch)
2006-11-26 17:01 UTC, Denis Vlasenko
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Denis Vlasenko 2006-11-26 16:55:20 UTC
# export LC_ALL=ru_RU.koi8r
# testparm
Load smb config files from /usr/app/samba-3.0.23d/var/etc/smb.conf
[hangs here until user presses ^C]

# unset LC_ALL
# testparm
Load smb config files from /usr/app/samba-3.0.23d/var/etc/smb.conf
testparm: gconv_db.c:232: __gconv_release_step: Assertion `step->__end_fct == ((void *)0)' failed.
[caught SIGABRT and died]

This is where it happens:

void init_iconv(void)
{
...
        for (c1=0;c1<NUM_CHARSETS;c1++) {
                for (c2=0;c2<NUM_CHARSETS;c2++) {
                        const char *n1 = charset_name((charset_t)c1);
                        const char *n2 = charset_name((charset_t)c2);

Second charset_name is eventually called with c2 == 2:

charset_name(2):
        ...
        if (ret && !strcmp(ret, "LOCALE")) {
                const char *ln = NULL;
                setlocale(LC_ALL, "");
                ln = nl_langinfo(CODESET);
                if (ln) {
                        smb_iconv_t handle = smb_iconv_open(ln,"UCS-2LE");
We do here:
smb_iconv_open("KOI8-R","UCS-2LE") [if LC_ALL set]
smb_iconv_open("ANSI_X3.4-1968","UCS-2LE") [if unset]
                        if (handle == (smb_iconv_t) -1) {
                                ...
                        } else {
                                smb_iconv_close(handle);

smb_iconv_close hangs or aborts. Here, in the first iconv_close:

int smb_iconv_close (smb_iconv_t cd)
{
#ifdef HAVE_NATIVE_ICONV
        if (cd->cd_direct) iconv_close((iconv_t)cd->cd_direct);
        ...
Comment 1 Denis Vlasenko 2006-11-26 17:00:10 UTC
I have glibc-2.4 on my system.

With the attached debugging patch:

# bin/testparm
here 1
here 2
here 3
here 4
here 5
here 6
here 7
here 8
here 9
Load smb config files from /usr/app/samba-3.0.23d/var/etc/smb.conf
here 10
here 11
here 12
here 13
here 14
here 15
here 18
here 19
here 1a
here 1b
here 1c
here 20
here 21
here 22
here 220
here 221: charset_name(0)
here 222
here 223
here 224
here 225
here 220
here 221: charset_name(1)
here 222
here 223
here 40
here 41
here 42
here 44
here 224
here 225
here 220
here 221: charset_name(2)
here 33
here 34
here 35
here 36: h = smb_iconv_open(KOI8-R,UCS-2LE)
here 37
here 38: smb_iconv_close(h)
here 40
here 41
here 42
here 44
here 39
here 222
here 223
here 224
here 225
here 220
here 221: charset_name(3)
here 222
here 223
here 224
here 225
here 220
here 221: charset_name(4)
here 222
here 223
here 224
here 225
here 220
here 221: charset_name(0)
here 222
here 223
here 40
here 41
here 42
here 44
here 224
here 225
here 220
here 221: charset_name(1)
here 222
here 223
here 224
here 225
here 220
here 221: charset_name(2)
here 33
here 34
here 35
here 36: h = smb_iconv_open(KOI8-R,UCS-2LE)
here 37
here 38: smb_iconv_close(h)
here 40
[I press ^C]

# env - bin/testparm
here 1
here 2
here 3
here 4
here 5
here 6
here 7
here 8
here 9
Load smb config files from /usr/app/samba-3.0.23d/var/etc/smb.conf
here 10
here 11
here 12
here 13
here 14
here 15
here 18
here 19
here 1a
here 1b
here 1c
here 20
here 21
here 22
here 220
here 221: charset_name(0)
here 222
here 223
here 224
here 225
here 220
here 221: charset_name(1)
here 222
here 223
here 40
here 41
here 42
here 44
here 224
here 225
here 220
here 221: charset_name(2)
here 33
here 34
here 35
here 36: h = smb_iconv_open(ANSI_X3.4-1968,UCS-2LE)
here 37
here 38: smb_iconv_close(h)
here 40
here 41
here 42
here 44
here 39
here 222
here 223
here 224
here 225
here 220
here 221: charset_name(3)
here 222
here 223
here 224
here 225
here 220
here 221: charset_name(4)
here 222
here 223
here 224
here 225
here 220
here 221: charset_name(0)
here 222
here 223
here 40
here 41
here 42
here 44
here 224
here 225
here 220
here 221: charset_name(1)
here 222
here 223
here 224
here 225
here 220
here 221: charset_name(2)
here 33
here 34
here 35
here 36: h = smb_iconv_open(ANSI_X3.4-1968,UCS-2LE)
here 37
here 38: smb_iconv_close(h)
here 40
testparm: gconv_db.c:232: __gconv_release_step: Assertion `step->__end_fct == ((void *)0)' failed.
Comment 2 Denis Vlasenko 2006-11-26 17:01:10 UTC
Created attachment 2235 [details]
Patch which adds debugging prints
Comment 3 Denis Vlasenko 2006-11-26 17:12:06 UTC
Forgot to mention: this is a "fresh" machine and my smb.conf is an empty file
Comment 4 Denis Vlasenko 2006-11-26 17:13:27 UTC
basically the same thing happens to all other samba programs, for example, smbclient.
Comment 5 Denis Vlasenko 2006-11-26 17:15:22 UTC
configure --build=i386-pc-linux-gnu --with-winbind --with-automount                       --with-smbmount --with-pam --with-pam_smbpass --with-included-popt                   
Comment 6 Denis Vlasenko 2006-11-26 18:13:08 UTC
Aha, I can use smbclient with bumped-up debug level for more data points:

# smbclient -d 100
INFO: Current debug levels:
  all: True/100
  tdb: False/0
  printdrivers: False/0
  lanman: False/0
  smb: False/0
  rpc_parse: False/0
  rpc_srv: False/0
  rpc_cli: False/0
  passdb: False/0
  sam: False/0
  auth: False/0
  winbind: False/0
  vfs: False/0
  idmap: False/0
  quota: False/0
  acls: False/0
  locking: False/0
  msdfs: False/0
  dmapi: False/0
lp_load: refreshing parameters
Initialising global parameters
params.c:pm_process() - Processing configuration file
"/usr/app/samba-3.0.23d/var/etc/smb.conf"
pm_process() returned Yes
lp_servicenumber: couldn't find homes
set_server_role: role = ROLE_STANDALONE
Attempting to register new charset UCS-2LE
Registered charset UCS-2LE
Attempting to register new charset UTF-16LE
Registered charset UTF-16LE
Attempting to register new charset UCS-2BE
Registered charset UCS-2BE
Attempting to register new charset UTF-16BE
Registered charset UTF-16BE
Attempting to register new charset UTF8
Registered charset UTF8
Attempting to register new charset UTF-8
Registered charset UTF-8
Attempting to register new charset ASCII
Registered charset ASCII
Attempting to register new charset 646
Registered charset 646
Attempting to register new charset ISO-8859-1
Registered charset ISO-8859-1
Attempting to register new charset UCS2-HEX
Registered charset UCS2-HEX
Substituting charset 'KOI8-R' for LOCALE
Substituting charset 'KOI8-R' for LOCALE
[hangs]

# env - smbclient -d 100
INFO: Current debug levels:
  all: True/100
  tdb: False/0
  printdrivers: False/0
  lanman: False/0
  smb: False/0
  rpc_parse: False/0
  rpc_srv: False/0
  rpc_cli: False/0
  passdb: False/0
  sam: False/0
  auth: False/0
  winbind: False/0
  vfs: False/0
  idmap: False/0
  quota: False/0
  acls: False/0
  locking: False/0
  msdfs: False/0
  dmapi: False/0
lp_load: refreshing parameters
Initialising global parameters
params.c:pm_process() - Processing configuration file
"/usr/app/samba-3.0.23d/var/etc/smb.conf"
pm_process() returned Yes
lp_servicenumber: couldn't find homes
set_server_role: role = ROLE_STANDALONE
Attempting to register new charset UCS-2LE
Registered charset UCS-2LE
Attempting to register new charset UTF-16LE
Registered charset UTF-16LE
Attempting to register new charset UCS-2BE
Registered charset UCS-2BE
Attempting to register new charset UTF-16BE
Registered charset UTF-16BE
Attempting to register new charset UTF8
Registered charset UTF8
Attempting to register new charset UTF-8
Registered charset UTF-8
Attempting to register new charset ASCII
Registered charset ASCII
Attempting to register new charset 646
Registered charset 646
Attempting to register new charset ISO-8859-1
Registered charset ISO-8859-1
Attempting to register new charset UCS2-HEX
Registered charset UCS2-HEX
Substituting charset 'ANSI_X3.4-1968' for LOCALE
Substituting charset 'ANSI_X3.4-1968' for LOCALE
smbclient: gconv_db.c:232: __gconv_release_step: Assertion `step->__end_fct ==
((void *)0)' failed.
[aborts]
Comment 7 Björn Jacke 2019-02-12 23:46:54 UTC
just tried this here with a Linux distro from 2018 (I know, this is 13 years later...) and it works. Are there still people using koi8r locales instead of utf-8 these days? I close this as worksforme unless you say this it's still broken for you.