[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Infinite loop in globbing

From: Chet Ramey
Subject: Re: Infinite loop in globbing
Date: Mon, 14 Mar 2011 10:55:32 -0400

> >> $ [$'\xFD'$'\xBA']
> >> ^C
> >>
> >> The bash 4.2 is in infinite loop. The bash 4.1 work well.
> > Can you give more details about the setup here?  Does the glob match
> > any files or not?
> Just need to set some utf8 locales (I guess, tried and using 
> en_US.UTF-8). It doesn't matter if the file exists.
> > In a NON-utf8 locale, with no matching files, I get:
> >
> > imadev:~$ [$'\xFD'$'\xBA']
> > bash: [ýº]: command not found
> >
> The same here. NON-utf8 locale working. bash-4.1 working also with utf8.
> bash-4.2 get stuck in xdupmbstowcs2() static function in do-while loop. 
> I know nearly nothing about wide chars so I don't know what is bad here.

The 0xfd is an invalid multibyte character, so it can't be converted to
a wide character.  mbsnrtowcs returns 0, which is kind of a dodgy error
(mbrlen returns -1 for the same character, for instance), but the code
doesn't handle that case.

The question is how to best handle it: punt immediately, or just treat it
as a single-byte character and move on.


``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    address@hidden    http://cnswww.cns.cwru.edu/~chet/

reply via email to

[Prev in Thread] Current Thread [Next in Thread]