Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 28 Feb 2002 13:30:09 -0500 (EST)
From:      "Alexander N. Kabaev" <ak03@gte.com>
To:        FreeBSD-gnats-submit@freebsd.org
Cc:        markm@freebsd.org
Subject:   bin/35421: WARNS=4 fixes broke ls for 8-bit locales
Message-ID:  <200202281830.g1SIU9Xv002496@kanpc.gte.com>

next in thread | raw e-mail | index | archive | help

>Number:         35421
>Category:       bin
>Synopsis:       WARNS=4 fixes broke ls for 8-bit locales
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Feb 28 10:40:01 PST 2002
>Closed-Date:
>Last-Modified:
>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:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200202281830.g1SIU9Xv002496>