On Fri, Aug 15, 2008 at 05:31:09PM +0100, Mark Brown wrote:
> On Fri, Aug 15, 2008 at 06:20:04PM +0200, Aurelien Jarno wrote:
> 
> > I don't expect ypcat to print a correct string when the encoding of the
> > NIS server and the locale of the client do not match, but at least it
> > should not drop the line, and either print the line with broken
> > characters or print an error message.
> 
> Could you please identify where in the current code the lines are
> dropped?  Unless yp_all() passes in an error status the data is going to
> get passed to fprintf() which I would expect to produce some
> (potentially mangled) output.

fprintf drops the line, and return a negative value, because the length
of the string does not correspond to the give value. This can be seen
from strace:

fprintf(0x7fa39d0b4780, "%*.*s\n", 61, 61, "aurel32:x:1000:1000:Aurelien 
Jar"...aurel32:x:1000:1000:Aurelien Jarno,,,:/home/aurel32:/bin/bash) = 62
fprintf(0x7fa39d0b4780, "%*.*s\n", 45, 45, 
"test:x:1001:1002:T\351st,,,:/home/"...) = -1

One of the solution is to check for an error in fprintf(), or to let the
program running in a C locale, by removing the switch at the beginning of
main.

-- 
  .''`.  Aurelien Jarno             | GPG: 1024D/F1BCDB73
 : :' :  Debian developer           | Electrical Engineer
 `. `'   [EMAIL PROTECTED]         | [EMAIL PROTECTED]
   `-    people.debian.org/~aurel32 | www.aurel32.net



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to