Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Strange behavior of [[



On Jun 9,  8:27pm, Maxime Arthaud wrote:
} Subject: Strange behavior of [[
}
} Hi everybody!
} 
} I just found a very strange behavior in zsh (v5.0.8).
} 
} % [[ " X" =~ "X" ]]
} where in " X" the first character is a non-breaking space (0xa0).
} My shell gets stuck, and Ctrl-C is not working. With bash, no problem.
} 
} Does anyone have an explanation? I think it's a bug.

MB_METACHARLEN() is returning that 0xa0 is a zero-width character, so
"ptr" in the "while (ptr < lhstr + m->rm_so)" loop in regex.c never
advances.  That macro ultimately resolves to mb_metacharlenconv_r()
from utils.c, which returns zero here:

4861		return 0;		/* Probably shouldn't happen */


This means that imeta() is (incorrectly?) returning true for 0xa0, which
might mean that we're passing an unmetafied string where a metafied
string is expected.



Messages sorted by: Reverse Date, Date, Thread, Author