Bug 692 - Truncated names of shares
Summary: Truncated names of shares
Status: CLOSED FIXED
Alias: None
Product: Samba 3.0
Classification: Unclassified
Component: smbclient (show other bugs)
Version: 3.0.0preX
Hardware: All Linux
: P3 critical
Target Milestone: none
Assignee: Gerald (Jerry) Carter (dead mail address)
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-10-28 05:45 UTC by Alex
Modified: 2005-11-14 09:30 UTC (History)
1 user (show)

See Also:


Attachments
proposed patch (1.31 KB, patch)
2004-02-18 22:51 UTC, SATOH Fumiyasu
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alex 2003-10-28 05:45:26 UTC
I have ru_RU.UTF-8 locale. If remote computer has share with russian name then 
smbclient gets the name of this share in truncated form. The shares with 
english names look correctly.
Comment 1 Jeremy Allison 2003-11-06 14:49:13 UTC
What are your smb.conf settings for language ?
Jeremy.
Comment 2 Alex 2003-11-07 05:44:38 UTC
   unix charset = utf8
   display charset = utf8
   dos charset = cp866
Comment 3 Jeremy Allison 2003-11-07 13:23:24 UTC
Your character set settings look correct as long as the shell
you are running in has the utf8 locale set.

Ok, can you tell me how you're getting the share names - doing 
smbclient -L ? Which Linux distribution are you running on ?
What iconv library (or glibc version) are you using ?
Are you really using 3.0.0rc1 or have you upgraded to
Samba 3.0 released ? Have you tried the 3.0.1pre release ?

Jeremy.

Comment 4 Alex 2003-11-08 00:41:14 UTC
You are right. I use 3.0.1pre release of samba.

$ iconv -V
iconv (GNU libc) 2.3.2
Copyright (C) 2003 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Written by Ulrich Drepper.

I use RedHat 9. kernel - 2.4.22
Yes, I use 'smbclient -L' to get shares.

But smbtree gets the names of shares correctly.
Comment 5 SATOH Fumiyasu 2004-02-18 22:47:08 UTC
Add Cc: sugj-tech@samba.gr.jp to track this problem.
Comment 6 SATOH Fumiyasu 2004-02-18 22:51:34 UTC
Created attachment 408 [details]
proposed patch

Alex, please try this patch.

In source/client/client.c, browse_fn() uses d_printf() with format
"%-15.15s" to print a sharename to terminal:

	       d_printf("\t%-15.15s%-10.10s%s\n",
				name,typestr,comment);

If length (byte number) of a sharename is longer than 15, printing
sharename is truncated.
Comment 7 SATOH Fumiyasu 2004-02-19 00:14:39 UTC
The patch in Additional Comment #6 has a fix for server_fn() function:

Index: source/client/client.c
===================================================================
RCS file: /cvsroot/samba/source/client/client.c,v
retrieving revision 1.209.2.48
diff -u -p -r1.209.2.48 client.c
--- source/client/client.c	12 Feb 2004 17:26:34 -0000	1.209.2.48
+++ source/client/client.c	19 Feb 2004 06:29:11 -0000
@@ -2037,7 +2037,7 @@ static void server_fn(const char *name, 
 {
 	
 	if (!grepable){
-		d_printf("\t%-16.16s     %s\n", name, comment);
+		d_printf("\t%-16s     %s\n", name, comment);
 	} else {
 		d_printf("%s|%s|%s\n",(char *)state, name, comment);
 	}

In some languages (e.g. Japanese), unix charset (e.g. UTF-8) and some
characters, length of a string encoded in unix charset is longer than
length of the string encoded in dos charset (CP932 for Windows Japanese
edition).

On the other hand, the limit of workgroupname byte length (15 or 16
(with name type)) is defined for dos charset.

If workgroupname length is <16 bytes (valid length) in dos charset
and is >16 bytes in unix charset, function:

    d_printf("\t%-16.16s     %s\n", name, comment);

truncates VALID workgroupname.

Do not discard the fix for this problem.
Comment 8 Gerald (Jerry) Carter (dead mail address) 2004-03-01 09:40:48 UTC
patch applied to 3.0 and HEAD
Comment 9 Gerald (Jerry) Carter (dead mail address) 2005-02-07 09:05:53 UTC
originally reported against one of the 3.0.0rc[1-4] releases.
Cleaning up non-production versions.
Comment 10 Gerald (Jerry) Carter (dead mail address) 2005-08-24 10:27:09 UTC
sorry for the same, cleaning up the database to prevent unecessary reopens of bugs.
Comment 11 Gerald (Jerry) Carter (dead mail address) 2005-11-14 09:30:49 UTC
database cleanup