bug-bash
[Top][All Lists]
Advanced

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

Re: string replace with multibyte chars and extglob fails with bash-4.2


From: Andreas Schwab
Subject: Re: string replace with multibyte chars and extglob fails with bash-4.2
Date: Sat, 21 Apr 2012 21:27:55 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.95 (gnu/linux)

Mike Frysinger <address@hidden> writes:

> first set your locale to something unicode based:
> export LC_ALL=en_US.UTF-8
>
> then try the simple script (from Ulrich Müller):
> $ cat test.sh
> shopt -s extglob
> text="aaaäöü"
> echo "${text} ${text//?aa} ${text//\aaa}"
>
> with bash-4.1_p2, i get:
> aaaäöü äöü äöü
>
> but with bash-4.2_p8 ... 4.2_p24 (just what i have locally):
> aaaäöü aaaäöü aaaäöü

diff --git a/subst.c b/subst.c
index 9feaa9c..ebd5138 100644
--- a/subst.c
+++ b/subst.c
@@ -4161,7 +4161,7 @@ match_wpattern (wstring, indices, wstrlen, wpat, mtype, 
sp, ep)
   simple = (wpat[0] != L'\\' && wpat[0] != L'*' && wpat[0] != L'?' && wpat[0] 
!= L'[');
 #if defined (EXTENDED_GLOB)
   if (extended_glob)
-    simple |= (wpat[1] != L'(' || (wpat[0] != L'*' && wpat[0] != L'?' && 
wpat[0] != L'+' && wpat[0] != L'!' && wpat[0] != L'@')); /*)*/
+    simple &= (wpat[1] != L'(' || (wpat[0] != L'*' && wpat[0] != L'?' && 
wpat[0] != L'+' && wpat[0] != L'!' && wpat[0] != L'@')); /*)*/
 #endif
 
   /* If the pattern doesn't match anywhere in the string, go ahead and

Andreas.

-- 
Andreas Schwab, address@hidden
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."



reply via email to

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