[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#1063518: console-setup: setupcon: 1386: Syntax error: Missing '))'



Package: console-setup
Version: 1.225
Severity: grave

After the upgrade from 1.223, console-setup.service failed to start due
to a syntax error in the setupcon script:

,----
| $ setupcon
| /usr/bin/setupcon: 1386: Syntax error: Missing '))'
`----

It looks like dash does not like the construct in line 907 where there
is an opening '$((' but the closing parentheses are split.

,----
| $ dash << 'EOF'
| > echo $((true))
| > echo $((true) )
| > EOF
| 0
| dash: 3: Syntax error: Missing '))'
| $
`----

I tried

dash << 'EOF'                                            [15:28:53]
if $( (true) 2>/dev/null); then
 echo "42"
fi
EOF
42

which only works in dash because of the added space between the command substitution $(...) and the subshell (...).

Does dash think it has to do arithmetic expansion "$((...))"?

bash and zsh in sh mode accept nesting a subshell within the command substitution without an extra space. In the last version of the script, backticks were used, circumventing this issue.

But what's POSIX take on this? I couldn't find anything. Is this a bug in dash or in setupcon?

Toto

PS: To the proposal of a cleanup: 'checkbashisms' doesn't return any
    errors, but IMHO, at least closing (double) quotes on
    a line of their own should be fixed:

$ cat /bin/setupcon | grep -n "^\(\"\|'\)$" [15:47:07]
    87:'
    145:"
    148:"
    190:"
    193:"
    208:"


Reply to: