Subject: bin/10858: ls' use of isprint() is not i18n ready.
To: None <gnats-bugs@gnats.netbsd.org>
From: None <kuebart@mathematik.uni-ulm.de>
List: netbsd-bugs
Date: 08/20/2000 02:52:22
>Number:         10858
>Category:       bin
>Synopsis:       ls' use of isprint() is not i18n ready.
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Aug 20 02:53:01 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator:     Joachim Kuebart
>Release:        Sat Jun 10, 2000
>Organization:
>Environment:
	
System: NetBSD yacht.domestic.de 1.4ZB NetBSD 1.4ZB (YACHT) #84: Sun Jun 11 15:01:09 CEST 2000 joki@yacht:/usr/src/sys/arch/i386/compile/YACHT i386


>Description:
	When printing to a tty, ls(1) tries to figure out whether
	to print '?' for a character using isprint(). However, in
	the call to isprint(), unspecified char's are cast to int
	which fails on architectures with signed char's because it
	yields a negative integers for characters > 0177.
>How-To-Repeat:
	Create a file whose name contains a character > 0177 which
	is marked printable in the current locale. ls(1) displays
	'?' nontheless.
>Fix:

The following patches lead to a correct use of the isprint() function
and make ls(1) display local characters in filenames correctly.

cvs diff: Diffing .
Index: extern.h
===================================================================
RCS file: /home/cvs/netbsd/src/bin/ls/extern.h,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 extern.h
--- extern.h	1999/06/14 20:17:29	1.1.1.1
+++ extern.h	2000/08/20 09:30:26
@@ -48,7 +48,7 @@
 
 int	 ls_main __P((int, char *[]));
 
-void	 prcopy __P((char *, char *, int));
+void	 prcopy __P((unsigned char *, unsigned char *, int));
 void	 printacol __P((DISPLAY *));
 void	 printcol __P((DISPLAY *));
 void	 printlong __P((DISPLAY *));
Index: util.c
===================================================================
RCS file: /home/cvs/netbsd/src/bin/ls/util.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 util.c
--- util.c	1999/06/14 20:17:29	1.1.1.1
+++ util.c	2000/08/20 09:30:08
@@ -59,7 +59,7 @@
 
 void
 prcopy(src, dest, len)
-	char *src, *dest;
+	unsigned char *src, *dest;
 	int len;
 {
 	int ch;
>Release-Note:
>Audit-Trail:
>Unformatted: