about summary refs log tree commit diff
path: root/Test
diff options
context:
space:
mode:
authorJun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>2023-06-26 16:52:40 +0900
committerJun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>2023-06-26 16:52:40 +0900
commit1b9bc3441ca0e6d155243084d6e7b98925dc02cb (patch)
tree5d2d1da390e86c628ec0248eb8bc9c9df5d49d7f /Test
parent4345eed1fe5dd6c881b948331cfa8f4a48beda42 (diff)
downloadzsh-1b9bc3441ca0e6d155243084d6e7b98925dc02cb.tar.gz
zsh-1b9bc3441ca0e6d155243084d6e7b98925dc02cb.tar.xz
zsh-1b9bc3441ca0e6d155243084d6e7b98925dc02cb.zip
51884: reset IFS if it contains invalid characters
This happens only if MULTIBYTE option is on.
Diffstat (limited to 'Test')
-rw-r--r--Test/D04parameter.ztst21
1 files changed, 21 insertions, 0 deletions
diff --git a/Test/D04parameter.ztst b/Test/D04parameter.ztst
index 2fd2f975f..0d44558a7 100644
--- a/Test/D04parameter.ztst
+++ b/Test/D04parameter.ztst
@@ -2280,6 +2280,27 @@ F:We do not care what $OLDPWD is, as long as it does not cause an error
 F:As of this writing, var=$@ and var="$@" with null IFS have unspecified
 F:behavior, see http://austingroupbugs.net/view.php?id=888
 
+  (
+  IFS=$'\x80'
+  if [[ $IFS = $' \t\n\0' ]]; then
+    echo OK     # if $'\x80' is illegal (e.g. Linux)
+  else          # otherwise (e.g. macOS), it should work as a separator
+    s=$'foo\x80\bar'
+    [[ ${${=s}[1]} = foo ]] && echo OK
+  fi
+  )
+0D:reset IFS to default if it contains illegal character
+>OK
+
+  (
+  unsetopt multibyte
+  IFS=$'\xc3\xa9'
+  s=$'foo\xc3bar\xa9boo'
+  echo ${${=s}[2]}
+  )
+0:eight bit chars in IFS should work if multibute option is off
+>bar
+
   () {
     setopt localoptions extendedglob
     [[ $- = [[:alnum:]]## ]] || print Failed 1