1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-03-09 15:50:02 +00:00
cde/src/cmd/ksh93/data
Johnothan King cd562b16e2 Port more shell lint improvements from illumos and ksh93v- (#374)
This commit adds onto <https://github.com/ksh93/ksh/pull/353> by porting
over two additional improvements to the shell linter:

1) The changes in the aforementioned pull request were merged into
   illumos-gate with an additional change.[*] The illumos revision of
   the patch improved the warning for (( $foo = $? )) to specify '$foo'
   causes the warning.[**] Example:
      $ ksh -n -c '(( $? != $bar ))'
      ksh: warning: line 1: in '(( $? != $bar ))', using '$' as in '$bar' is slower and can introduce rounding errors
   While I was porting the illumos patch I did notice one problem. The
   string it uses from paramsub() skips over the initial '{' in
   '${var}', resulting in the warning printing '$var}' instead:
      $ ksh -n -c '(( ${.sh.pid} != $$ ))'
      ...  in '(( ${.sh.pid} != $$ ))', using '$' as in '$.sh.pid}' is slower  ...
   This was fixed by including the missing '{' in the string returned by
   paramsub for ${var} variables.

2) In ksh93v-, parsing x=$((expr)) with the shell linter will cause ksh
   to warn the user x=$((expr)) is slower than ((x=expr)). This
   improvement has been backported with a modified warning:
      # Result from this commit
      $ ksh -n -c 'x=$((1 + 2))'
      ksh: warning: line 1: x=$((1 + 2)) is slower than ((x=1 + 2))
      # Result from ksh93v-
      $ ksh93v -n -c 'x=$((1 + 2))'
      ksh93v: warning: line 1: ((x=1 + 2)) is more efficient than x=$((1 + 2))
   Minor note: the ksh93v- patch had an invalid use of memcmp; this
   version of the patch uses strncmp instead.

References:
be548e87bc
65722363_22fdf8e7/
2021-12-13 01:49:37 +01:00
..
aliases.c Add ksh 93u+m contributors notice to 964 copyright headers 2021-04-26 00:19:31 +01:00
builtins.c cleanup: get rid of KSHELL and _BLD_shell preprocessor macros 2021-12-09 06:43:22 +01:00
keywords.c Add ksh 93u+m contributors notice to 964 copyright headers 2021-04-26 00:19:31 +01:00
lexstates.c Port more shell lint improvements from illumos and ksh93v- (#374) 2021-12-13 01:49:37 +01:00
limits.c Add ksh 93u+m contributors notice to 964 copyright headers 2021-04-26 00:19:31 +01:00
math.tab Back port ksh93v- float, int, and exp10 changes from math.tab (#299) 2021-05-08 04:43:37 +01:00
msg.c Add ksh 93u+m contributors notice to 964 copyright headers 2021-04-26 00:19:31 +01:00
options.c Add ksh 93u+m contributors notice to 964 copyright headers 2021-04-26 00:19:31 +01:00
signals.c Add ksh 93u+m contributors notice to 964 copyright headers 2021-04-26 00:19:31 +01:00
strdata.c Remove duplicate error message 2021-11-15 21:15:41 +01:00
testops.c manual: use consistent terminology 2021-11-19 03:54:42 +01:00
variables.c Revert "[1.0 release prep] Remove tilde expansion discipline" 2021-12-09 07:31:37 +01:00