[Samba] Conversion error: Illegal multibyte sequence

Laurent Blume laurent+samba at elanor.org
Thu Sep 5 15:28:14 MDT 2013


On 2013-09-05 10:35 PM, Jeremy Allison wrote:
> This is the call to smb_iconv() returning an errno of EINVAL.
> 
> Firstly, add some debug statements inside smb_iconv_open_ex()
> to find out if we're using the sys_iconv() function (that
> calls the system iconv) or the internal UFT8 converters.
> 
> If it's the system iconv then you'll have to look inside
> that source code.
> 
> If it's the internal converters add some debug statements
> inside utf8_pull() and utf8_push() to see where the EINVAL
> is being returned.
> 
> This will help track it down for your individual case.

I'm not sure I'm still good at adding printf("DEBUG\n") lines around :-)
so I tried my hand with dtrace for a start.

Here are some examples of what it returns when looking at smb_iconv()
while I opened the directory and listed the content:

  0  61539                  smb_iconv:entry
  0  88770     convert_string_talloc:return
  0  88786          push_ucs2_talloc:return
  0  69264                 talloc_tos:entry
  0  88535                talloc_tos:return
  0  69516           push_ucs2_talloc:entry
  0  69500      convert_string_talloc:entry
  0  69497       lazy_initialize_conv:entry
  0  88767      lazy_initialize_conv:return
  0  61537      get_iconv_convenience:entry
  0  61585     get_iconv_convenience:return
  0  69852            get_conv_handle:entry
  0  89122           get_conv_handle:return
  0  82016            _talloc_realloc:entry
  0  81992          talloc_alloc_pool:entry
  0  81991    talloc_pool_objectcount:entry
  0 101091   talloc_pool_objectcount:return
  0 101092         talloc_alloc_pool:return
  0 101116           _talloc_realloc:return


  0  61539                  smb_iconv:entry
  0  88770     convert_string_talloc:return
  0  88786          push_ucs2_talloc:return
  0  69821                 strupper_w:entry
  0  69840                  toupper_w:entry
  0  69846                  toupper_m:entry
  0  89116                 toupper_m:return
  0  89110                 toupper_w:return
  0  69840                  toupper_w:entry
  0  69846                  toupper_m:entry
  0  75259                    toupper:entry
  0  94407                   toupper:return
  0  89116                 toupper_m:return
  0  89110                 toupper_w:return
  0  69840                  toupper_w:entry
  0  69846                  toupper_m:entry
  0  75259                    toupper:entry
  0  94407                   toupper:return
  0  89116                 toupper_m:return
  0  89110                 toupper_w:return
  0  89091                strupper_w:return
  0  69499             convert_string:entry
  0  69497       lazy_initialize_conv:entry
  0  88767      lazy_initialize_conv:return
  0  61537      get_iconv_convenience:entry
  0  61585     get_iconv_convenience:return
  0  69852            get_conv_handle:entry
  0  89122           get_conv_handle:return

Does it make sense? There are some longer examples, but the only
function call containing iconv is get_iconv_convenience().

Laurent


More information about the samba mailing list