delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin-developers/2001/05/30/11:50:12

Mailing-List: contact cygwin-developers-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-developers-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin-developers/>
List-Post: <mailto:cygwin-developers AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-developers-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-developers-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin-developers AT sources DOT redhat DOT com
X-Apparently-From: <earnie?boyd AT yahoo DOT com>
Message-ID: <3B151688.B6ABA6FD@yahoo.com>
Date: Wed, 30 May 2001 11:49:28 -0400
From: Earnie Boyd <earnie_boyd AT yahoo DOT com>
Reply-To: Cygwin Developers <cygwin-developers AT cygwin DOT com>
X-Mailer: Mozilla 4.76 [en] (WinNT; U)
X-Accept-Language: en
MIME-Version: 1.0
To: egor duda <cygwin-developers AT cygwin DOT com>
Subject: Re: isspace() & i18n
References: <13254193676 DOT 20010530145756 AT logos-m DOT ru>
<20010530095254 DOT B17603 AT redhat DOT com> <9265832872 DOT 20010530181156 AT logos-m DOT ru>
<20010530101516 DOT E17603 AT redhat DOT com> <3066562491 DOT 20010530182405 AT logos-m DOT ru>

This is a multi-part message in MIME format.
--------------F65F4675320FECE63D76F302
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

egor duda wrote:
> 
> Hi!
> 
> Wednesday, 30 May, 2001 Christopher Faylor cgf AT redhat DOT com wrote:
> 
> CF> On Wed, May 30, 2001 at 06:11:56PM +0400, egor duda wrote:
> >>Wednesday, 30 May, 2001 Christopher Faylor cgf AT redhat DOT com wrote:
> >>CF> On Wed, May 30, 2001 at 02:57:56PM +0400, egor duda wrote:
> >>>>  cygwin calls newlib's isspace() passing it a signed char. this works
> >>>>ok for ascii symbols 0x00-0x7f, but fails with, say, cyrillic symbols
> >>>> with codes > 0x80. As a result `cd dir-with-last-cyrillic-letter'
> >>>>fails as chdir strips last symbols, thinking they're spaces --
> >>>>isspace() is called with negative parameter.
> >>>>
> >>>>Any thoughts as of how we should handle this?
> >>
> >>CF> Maybe we just need a cygwin_isspace which checks for just tabs and spaces?
> >>
> >>it's possible, of course, but the problem with referencing negative
> >>array indices in is*() remains.
> >>
> >>i think we should either conform to standard and explicitly convert
> >>types or define appropriate strings as unsigned char*, (typedef PATH_STR,
> >>perhaps), or define cygwin_is*() as macros that do the conversion, or,
> >>as glibc does, expand _ctype to allow indices in range [-128,256].
> 
> CF> IMO, "we" should convert the arguments to the is* functions to unsigned
> CF> char. This is a decision for the newlib folks though, isn't it?
> 
> in actual calls, not in prototypes. newlib's currently takes int as
> is*() argument, and is absolutely right because standard says so. it's
> a caller's responsibility to provide correct parameters. so conversion
> should take place in cygwin code, not in newlib's. mimicking glibc
> behavior -- accepting negative arguments to support broken callers, is
> newlib folks decision.
> 

So does this solve the problem?

-- 
Earnie.
--------------F65F4675320FECE63D76F302
Content-Type: text/plain; charset=us-ascii;
 name="path.cc.diff.txt"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="path.cc.diff.txt"

Index: path.cc
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/path.cc,v
retrieving revision 1.139
diff -u -p -r1.139 path.cc
--- path.cc	2001/05/14 02:52:12	1.139
+++ path.cc	2001/05/30 15:45:49
@@ -2929,7 +2929,7 @@ chdir (const char *dir)
      whitespace to SetCurrentDirectory.  This doesn't work too well
      with other parts of the API, though, apparently.  So nuke trailing
      white space. */
-  for (s = strchr (dir, '\0'); --s >= dir && isspace (*s); )
+  for (s = strchr (dir, '\0'); --s >= dir && isspace ((unsigned int)*s); )
     *s = '\0';
 
   if (path.error)

--------------F65F4675320FECE63D76F302--


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019