Project

General

Profile

Actions

Feature #14277

closed

Improve shell lint checks

Added by Andy Fiddaman 6 months ago. Updated 6 months ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
cmd - userland programs
Start date:
Due date:
% Done:

100%

Estimated time:
Difficulty:
Bite-size
Tags:
Gerrit CR:

Description

https://github.com/ksh93/ksh recently pulled in some of the shell linter improvements from illumos issues #13601 and #13631 but they improved the code and removed the explicit string comparisons.
We should re-sync with their version - https://github.com/ksh93/ksh/pull/353


Related issues

Related to illumos gate - Bug #13601: ksh shell lint misleadingClosedAndy Fiddaman

Actions
Related to illumos gate - Bug #13631: shell lint about variable expansion in arithmetic expressions is inscrutableClosedAndy Fiddaman

Actions
Actions #1

Updated by Andy Fiddaman 6 months ago

  • Related to Bug #13601: ksh shell lint misleading added
Actions #2

Updated by Andy Fiddaman 6 months ago

  • Related to Bug #13631: shell lint about variable expansion in arithmetic expressions is inscrutable added
Actions #3

Updated by Andy Fiddaman 6 months ago

With the new changes, the lint output becomes:

/data/omnios-build/ksh/linttest: warning: line 5: [[... -eq ...]] obsolete, use ((... == ...))
/data/omnios-build/ksh/linttest: warning: line 6: [[... -ne ...]] obsolete, use ((... != ...))
/data/omnios-build/ksh/linttest: warning: line 7: [[... -lt ...]] obsolete, use ((... < ...))
/data/omnios-build/ksh/linttest: warning: line 8: [[... -gt ...]] obsolete, use ((... > ...))
/data/omnios-build/ksh/linttest: warning: line 9: [[... -le ...]] obsolete, use ((... <= ...))
/data/omnios-build/ksh/linttest: warning: line 10: [[... -ge ...]] obsolete, use ((... >= ...))
/data/omnios-build/ksh/linttest: warning: line 14: in '(( $a > 1 ))', using '$' is slower and can introduce rounding errors
Actions #4

Updated by Electric Monk 6 months ago

  • Gerrit CR set to 1834
Actions #5

Updated by Electric Monk 6 months ago

  • Status changed from In Progress to Closed
  • % Done changed from 0 to 100

git commit be548e87bcb4979e0b8a7bce5620a9916b888fdc

commit  be548e87bcb4979e0b8a7bce5620a9916b888fdc
Author: Andy Fiddaman <omnios@citrus-it.co.uk>
Date:   2021-12-06T16:51:35.000Z

    14277 Improve shell lint checks
    Reviewed by: Robert Mustacchi <rm+illumos@fingolfin.org>
    Approved by: Dan McDonald <danmcd@joyent.com>

Actions

Also available in: Atom PDF