From ak03@gte.com  Thu Feb 28 10:30:11 2002
Return-Path: <ak03@gte.com>
Received: from h132-197-179-27.gte.com (h132-197-179-27.gte.com [132.197.179.27])
	by hub.freebsd.org (Postfix) with ESMTP
	id B4F8637B417; Thu, 28 Feb 2002 10:30:10 -0800 (PST)
Received: from kanpc.gte.com (localhost [IPv6:::1])
	by h132-197-179-27.gte.com (8.12.2/8.12.2) with ESMTP id g1SIU9P1002497;
	Thu, 28 Feb 2002 13:30:10 -0500 (EST)
	(envelope-from ak03@kanpc.gte.com)
Received: (from ak03@localhost)
	by kanpc.gte.com (8.12.2/8.12.2/Submit) id g1SIU9Xv002496;
	Thu, 28 Feb 2002 13:30:09 -0500 (EST)
Message-Id: <200202281830.g1SIU9Xv002496@kanpc.gte.com>
Date: Thu, 28 Feb 2002 13:30:09 -0500 (EST)
From: "Alexander N. Kabaev" <ak03@gte.com>
Reply-To: "Alexander N. Kabaev" <ak03@gte.com>
To: FreeBSD-gnats-submit@freebsd.org
Cc: markm@freebsd.org
Subject: WARNS=4 fixes broke ls for 8-bit locales
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         35421
>Category:       bin
>Synopsis:       WARNS=4 fixes broke ls for 8-bit locales
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Feb 28 10:40:01 PST 2002
>Closed-Date:    Thu Feb 28 10:53:09 PST 2002
>Last-Modified:  Thu Feb 28 10:55:46 PST 2002
>Originator:     Alexander N. Kabaev
>Release:        FreeBSD 5.0-CURRENT i386
>Organization:
Verizon Data Services
>Environment:
System: FreeBSD kanpc.gte.com 5.0-CURRENT FreeBSD 5.0-CURRENT #3: Thu Feb 28 10:22:51 EST 2002 root@kanpc.gte.com:/usr/src/sys/i386/compile/KANPC i386


	
>Description:
	The revision 1.27 of src/bin/ls/util.c contains incorrent
	removal of the 'unsigned' attribute from the local char c
	varibale in prn_printable function. This causes chars with
	eith bit set to be promoted to negative int in isprint call,
	which in turn makes it non-printable as far as isprint function
	is concerned. This sequence effectively causes all russian file
	names to be printed as a sequence of '?' characters.
>How-To-Repeat:
	ls in directory with any names in single-byte non-Latin1 encoding
>Fix:

Index: util.c
===================================================================
RCS file: /usr/ncvs/src/bin/ls/util.c,v
retrieving revision 1.28
diff -u -r1.28 util.c
--- util.c	3 Feb 2002 20:55:54 -0000	1.28
+++ util.c	28 Feb 2002 18:18:16 -0000
@@ -60,10 +60,10 @@
 int
 prn_printable(const char *s)
 {
-	char c;
+	unsigned char c;
 	int n;
 
-	for (n = 0; (c = *s) != '\0'; ++s, ++n)
+	for (n = 0; (c = (unsigned char)*s) != '\0'; ++s, ++n)
 		if (isprint(c))
 			putchar(c);
 		else

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: ache 
State-Changed-When: Thu Feb 28 10:53:09 PST 2002 
State-Changed-Why:  
Fixed 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=35421 
>Unformatted:
