1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-02-24 15:04:13 +00:00
cde/src/cmd/ksh93/include
Johnothan King 8b5f11dcd7
Add support for multibyte characters to $IFS (#92)
Add support for multibyte characters to $IFS

This commit fixes BUG_MULTIBIFS, which had two bug reports in the ksh2020 branch.

src/cmd/ksh93/sh/macro.c:
- Backport Eric Scrivner's fix for multibyte IFS characters (slightly modified
  for compatibility with C89). Explanation from https://github.com/att/ast/pull/737:

  Previously, the varsub method used for the macro expansion of $param, ${param},
  and ${param op word} would incorrectly expand the internal field separator (IFS)
  if it was a multibyte character. This was due to truncation based on the
  incorrect assumption that the IFS would never be larger than a single byte.

  This change fixes this issue by carefully tracking the number of bytes that
  should be persisted in the IFS case and ensuring that all bytes are written
  during expansion and substitution.

  Bug report: https://github.com/att/ast/issues/13

- Fixed another bug that caused multibyte characters with the same initial byte
  to be treated as the same character by the IFS. This bug was occurring because
  the first byte of a multibyte character wasn't being written to the stack when
  the IFS delimiter had the same initial byte:

  $ IFS=£
  $ v='§'
  $ set -- $v
  $ v="${1-}"
  $ echo "$v" | hd # The first byte should be c2, but it isn't due to the bug
  00000000  a7 0a                                             |..|
  00000002

  Bug report: https://github.com/att/ast/issues/1372

src/cmd/ksh93/tests/variables.sh:
- Add (reworked) regression tests from ksh2020 for the multibyte IFS bugs.
- Add a regression test for att/ast#1372 based on the reproducer.
2020-07-25 19:46:11 +01:00
..
argnod.h 4 typo fixes: be use => be used 2020-07-05 07:48:01 +02:00
builtins.h Convert default typeset aliases to regular builtins 2020-07-15 20:54:06 +01:00
defs.h Remove unused libcoshell 2020-07-17 19:28:52 +01:00
edit.h Fix 80 typos in comments 2020-06-12 01:45:12 +02:00
env.h Fix 80 typos in comments 2020-06-12 01:45:12 +02:00
fault.h Fix 80 typos in comments 2020-06-12 01:45:12 +02:00
fcin.h Version: 2012-08-01-master 2016-01-11 15:54:23 -05:00
history.h Version: 2012-08-01-master 2016-01-11 15:54:23 -05:00
io.h rm "I/O error" error msg; just keep >0 exit status (re: 9011fa93) 2020-06-12 01:45:18 +02:00
jobs.h Remove unused libcoshell 2020-07-17 19:28:52 +01:00
lexstates.h Fix 80 typos in comments 2020-06-12 01:45:12 +02:00
name.h Fix 'whence -a' to print correct path for tracked alias (#25) 2020-06-19 14:03:58 +02:00
national.h Version: 2012-08-01-master 2016-01-11 15:54:23 -05:00
nval.h Merge dtksh patches from one of the CDE developers (#85) 2020-07-22 06:44:24 +01:00
path.h remove unused 'is an exported alias' message (re: 80d9ae2b) 2020-07-19 06:21:14 +01:00
regress.h Version: 2012-08-01-master 2016-01-11 15:54:23 -05:00
shell.h Fix three bugs in the sleep builtin (#77) 2020-07-17 05:00:28 +01:00
shlex.h Version: 2012-08-01-master 2016-01-11 15:54:23 -05:00
shnodes.h Version: 2012-08-01-master 2016-01-11 15:54:23 -05:00
shtable.h Make the 'history' and 'r' commands builtins (#76) 2020-07-16 18:56:49 +01:00
streval.h Version: 2012-08-01-master 2016-01-11 15:54:23 -05:00
terminal.h Fixes for implicit declaration warnings 2020-06-14 09:55:08 -04:00
test.h Version: 2012-08-01-master 2016-01-11 15:54:23 -05:00
timeout.h Version: 2012-08-01-master 2016-01-11 15:54:23 -05:00
ulimit.h Version: 2012-08-01-master 2016-01-11 15:54:23 -05:00
variables.h Remove code related to long-dead 3DFS research project 2020-06-12 01:45:17 +02:00
version.h Add support for multibyte characters to $IFS (#92) 2020-07-25 19:46:11 +01:00