| Q |
A |
| OS |
macOS / Linux |
| Shell & version |
bash 3.2.57 |
| bashunit version |
0.50.1 |
Summary
test_src_has_no_parameter_expansion_case_conversion misses ${1,,} and ${@,,}. Its pattern requires a variable name starting with a letter or underscore, so positional and special parameters slip through.
Current behavior
The rule at tests/unit/project/bash_compatibility_test.sh:85-88 builds its pattern around a name class of [A-Za-z_][A-Za-z0-9_]*. Checking three spellings of the same Bash 4.0 construct, only one is caught:
${var,,} caught
${1,,} not caught
${@,,} not caught
${var,,} and ${var^^} are Bash 4.0. They fail at runtime on 3.0 and 3.2, so an uncaught one ships and breaks only when the line executes. That is the exact gap the file's header comment (:5-8) says these greps exist to close.
Expected behavior
Widen the name class to include positional parameters and the special parameters, so every spelling of the construct is rejected. Add the missed spellings as cases so the rule cannot silently narrow again.
Found while auditing the compatibility rules against a real Bash 3.0.
Summary
test_src_has_no_parameter_expansion_case_conversionmisses${1,,}and${@,,}. Its pattern requires a variable name starting with a letter or underscore, so positional and special parameters slip through.Current behavior
The rule at
tests/unit/project/bash_compatibility_test.sh:85-88builds its pattern around a name class of[A-Za-z_][A-Za-z0-9_]*. Checking three spellings of the same Bash 4.0 construct, only one is caught:${var,,}caught${1,,}not caught${@,,}not caught${var,,}and${var^^}are Bash 4.0. They fail at runtime on 3.0 and 3.2, so an uncaught one ships and breaks only when the line executes. That is the exact gap the file's header comment (:5-8) says these greps exist to close.Expected behavior
Widen the name class to include positional parameters and the special parameters, so every spelling of the construct is rejected. Add the missed spellings as cases so the rule cannot silently narrow again.
Found while auditing the compatibility rules against a real Bash 3.0.