1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-03-09 15:50:02 +00:00

Backport ksh93v- bugfix for [[ 1<2 ]] (#380)

Strings compared in [[ with the > and < operators should be compared
lexically. This does not work when the strings are single digits, as
the parser interprets it as a syntax error:
   $ [[ 10<2 ]]   # 10 lexically sorts before 2
   $ echo $?
   0
   $ [[ 1<2 ]]
   /usr/bin/ksh: syntax error: `<' unexpected
   $ echo $?
   3

src/cmd/ksh93/sh/lex.c:
- Don't interpret numbers next to > and < as a redirection while
  inside of [[. This bugfix was backported from ksh93v- 2014-06-25.

src/cmd/ksh93/tests/bracket.sh:
- Add regression tests for the > and < operators.
This commit is contained in:
Johnothan King 2021-12-16 18:24:56 -08:00 committed by Martijn Dekker
parent e67df29c07
commit 85199ab351
3 changed files with 58 additions and 1 deletions

3
NEWS
View file

@ -10,6 +10,9 @@ Any uppercase BUG_* names are modernish shell bug IDs.
a subshell. Types can now safely be defined in subshells and defined
conditionally as in 'if condition; then enum ...; fi'.
- Single digits can now be compared lexically in [[ ... ]] with the
< and > operators.
2021-12-16:
- Changed the default selection of compiled-in /opt/ast/bin built-in libcmd