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

2024-02-09 Thread Philip Hands
Michael Tokarev  writes:

> 09.02.2024 16:58, ca...@allfreemail.net
>> Package: console-setup
>> Followup-For: Bug #1063518
>> 
>> Consider making all scripts provided by console-setup
>> shellcheck-clean, there are lots of tiny issues that can turn into
>> big issues under the right conditions.
>
> Please do not do this. Shellcheck is a huge problem and we had large amount
> of bugs due to people trying to apply its suggestions.  It's very difficult
> in many cases to spot why shellcheck is wrong (classic is the suggestion to
> put $var into double quotes "$var" which breaks badly if $var is supposed to
> contain zero or more separate words - this way, even boot scripts has become
> buggy leading to system becoming unbootable).
>
> Shellcheck is a very bad tool.

I think the reality is somewhere between these two positions.

Shellcheck is not particularly helpful for most of D-I because it
doesn't have a shell variant that perfectly matches our busybox sh
build.  That might have just improved, since I notice that a busybox sh
variant has just been merged upstream, so we'll see if that makes things
better.

On the other hand, if I'd been paying attention at the time, the fact
that this change dropped the number of shellcheck reports for setupcon
from 189 to 1 should have rung some alarm bells, but it seems that I've
learnt to ignore the little '!' in my emacs status bar -- I'll have to
keep an eye on that in future.

Cheers, Phil.
-- 
Philip Hands -- https://hands.com/~phil



console-setup_1.226_source.changes ACCEPTED into unstable

2024-02-09 Thread Debian FTP Masters
Thank you for your contribution to Debian.



Accepted:

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA512

Format: 1.8
Date: Fri, 09 Feb 2024 15:45:38 +0100
Source: console-setup
Architecture: source
Version: 1.226
Distribution: unstable
Urgency: medium
Maintainer: Debian Install System Team 
Changed-By: Philip Hands 
Closes: 1063518
Changes:
 console-setup (1.226) unstable; urgency=medium
 .
   * Team upload
 .
   * setupcon: fix mistaken $((  (closes: 1063518)
Checksums-Sha1:
 84294e5b75b00aad2cced6b0cfab0635682b6c3e 3340 console-setup_1.226.dsc
 ff1036c7201a486a791040148128711a5a746106 1685272 console-setup_1.226.tar.xz
Checksums-Sha256:
 25d949da1eb3e494bed1f3fc11074c5221ce54bd1463963b0b9417b9b89922f9 3340 
console-setup_1.226.dsc
 992be8dfcc5b99c42cb0f2914d987298e281e9232eb2492302d97dc3ff6412bd 1685272 
console-setup_1.226.tar.xz
Files:
 82130112e2f68bcbbe925f8d337b7acd 3340 utils optional console-setup_1.226.dsc
 81e55c7e628e52eeb52efa6cbaeeb03f 1685272 utils optional 
console-setup_1.226.tar.xz

-BEGIN PGP SIGNATURE-

iQJDBAEBCgAtFiEE3/FBWs4yJ/zyBwfW0EujoAEl1cAFAmXGQE8PHHBoaWxAaGFu
ZHMuY29tAAoJENBLo6ABJdXAuuMP/i3ZoM4rKVGU3yZilBPOYOeLxvPdqHzqxGuZ
huCceNMgLX7CFN4Je1t2CoUwV5Xp8V9/+uR1ZZ624nvoH+iIsuSyK9N+uk/xFTw+
9fwNgY3Wf1bRI7H6jMF35ZK8pwo9I1aCzoflEI/dTemzTi5ewgaGKwSL+MEkuZwB
MBs1gpnEe8ERsTfE6DEb9/7V8eK2rLXq1RFXSu1M+wMGG8i0vmvV7KavUcs1obgL
kYH0YMRO6DnBfmzqb3mOnwF3LKBRoiyejh8tk7qREfd5UDSt5zCwd+3erarFIjaw
3j4aPV6b26vMzlEIr85HhodjU0dOSrM/UeuYIQPTH0pvKO9mo9RXJ4FoJ8RVgALG
5/kGZIJJNlBASKksLli/HWR2zonyExz9d6un9KwQg7825TT4q5uaH09ytmfYI4Dz
nJL4VeUybWo/EyqfplknUUi3yBmlCAaUx3uuS1hYO2/HFDYa2YZP6RA4jEV9sreJ
koGzSI0AowPSziGx6n3rOiSLUfpik8ZBCfy+alm4zB5XYtPW/60qmYIs67UKqdmd
hnnPDQAAwF4Vmhb1f8ZXRpOLyvIgnx+vWWdy1pQf9YZFHA/UmTIPSR0ZAPtupLdj
HFHdQLeE0I5ZjymHVyh1SyUUK4v5swXYasfvXBXhTADODgMo1BXmZ9hQz+Bi31GP
MYv0Hz4t
=YBWD
-END PGP SIGNATURE-



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

2024-02-09 Thread Michael Tokarev

09.02.2024 17:57, Thorsten Bonow :

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 "$((...))"?


Yes, arithmetic, and that's what bash does too.  dash does not understand
space between two closing parens though, ') )'.  And this is logical - if
the opening is "((", use the same matching "))" for closing.

$(( ... )) is arithmetic expression,
$( ( ... ) ) is a subshell.

Everything else is asking for trouble like this.


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


It's a bug in setupcon.

/mjt



Processing of console-setup_1.226_source.changes

2024-02-09 Thread Debian FTP Masters
console-setup_1.226_source.changes uploaded successfully to localhost
along with the files:
  console-setup_1.226.dsc
  console-setup_1.226.tar.xz

Greetings,

Your Debian queue daemon (running on host usper.debian.org)



Bug#1063518: marked as done (console-setup: setupcon: 1386: Syntax error: Missing '))')

2024-02-09 Thread Debian Bug Tracking System
Your message dated Fri, 09 Feb 2024 15:34:15 +
with message-id 
and subject line Bug#1063518: fixed in console-setup 1.226
has caused the Debian Bug report #1063518,
regarding console-setup: setupcon: 1386: Syntax error: Missing '))'
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact ow...@bugs.debian.org
immediately.)


-- 
1063518: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1063518
Debian Bug Tracking System
Contact ow...@bugs.debian.org with problems
--- Begin Message ---
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 '))'
| $
`


-- System Information:
Debian Release: trixie/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (101, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386
--- End Message ---
--- Begin Message ---
Source: console-setup
Source-Version: 1.226
Done: Philip Hands 

We believe that the bug you reported is fixed in the latest version of
console-setup, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 1063...@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Philip Hands  (supplier of updated console-setup package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmas...@ftp-master.debian.org)


-BEGIN PGP SIGNED MESSAGE-
Hash: SHA512

Format: 1.8
Date: Fri, 09 Feb 2024 15:45:38 +0100
Source: console-setup
Architecture: source
Version: 1.226
Distribution: unstable
Urgency: medium
Maintainer: Debian Install System Team 
Changed-By: Philip Hands 
Closes: 1063518
Changes:
 console-setup (1.226) unstable; urgency=medium
 .
   * Team upload
 .
   * setupcon: fix mistaken $((  (closes: 1063518)
Checksums-Sha1:
 84294e5b75b00aad2cced6b0cfab0635682b6c3e 3340 console-setup_1.226.dsc
 ff1036c7201a486a791040148128711a5a746106 1685272 console-setup_1.226.tar.xz
Checksums-Sha256:
 25d949da1eb3e494bed1f3fc11074c5221ce54bd1463963b0b9417b9b89922f9 3340 
console-setup_1.226.dsc
 992be8dfcc5b99c42cb0f2914d987298e281e9232eb2492302d97dc3ff6412bd 1685272 
console-setup_1.226.tar.xz
Files:
 82130112e2f68bcbbe925f8d337b7acd 3340 utils optional console-setup_1.226.dsc
 81e55c7e628e52eeb52efa6cbaeeb03f 1685272 utils optional 
console-setup_1.226.tar.xz

-BEGIN PGP SIGNATURE-

iQJDBAEBCgAtFiEE3/FBWs4yJ/zyBwfW0EujoAEl1cAFAmXGQE8PHHBoaWxAaGFu
ZHMuY29tAAoJENBLo6ABJdXAuuMP/i3ZoM4rKVGU3yZilBPOYOeLxvPdqHzqxGuZ
huCceNMgLX7CFN4Je1t2CoUwV5Xp8V9/+uR1ZZ624nvoH+iIsuSyK9N+uk/xFTw+
9fwNgY3Wf1bRI7H6jMF35ZK8pwo9I1aCzoflEI/dTemzTi5ewgaGKwSL+MEkuZwB
MBs1gpnEe8ERsTfE6DEb9/7V8eK2rLXq1RFXSu1M+wMGG8i0vmvV7KavUcs1obgL
kYH0YMRO6DnBfmzqb3mOnwF3LKBRoiyejh8tk7qREfd5UDSt5zCwd+3erarFIjaw
3j4aPV6b26vMzlEIr85HhodjU0dOSrM/UeuYIQPTH0pvKO9mo9RXJ4FoJ8RVgALG
5/kGZIJJNlBASKksLli/HWR2zonyExz9d6un9KwQg7825TT4q5uaH09ytmfYI4Dz
nJL4VeUybWo/EyqfplknUUi3yBmlCAaUx3uuS1hYO2/HFDYa2YZP6RA4jEV9sreJ
koGzSI0AowPSziGx6n3rOiSLUfpik8ZBCfy+alm4zB5XYtPW/60qmYIs67UKqdmd
hnnPDQAAwF4Vmhb1f8ZXRpOLyvIgnx+vWWdy1pQf9YZFHA/UmTIPSR0ZAPtupLdj
HFHdQLeE0I5ZjymHVyh1SyUUK4v5swXYasfvXBXhTADODgMo1BXmZ9hQz+Bi31GP
MYv0Hz4t
=YBWD
-END PGP SIGNATURE End Message ---


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

2024-02-09 Thread Thorsten Bonow

Thorsten Bonow  writes:


[...]


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


I'm stupid[1].  It's a bug in setupcon, POSIX requires the space:

"The syntax of the shell command language has an ambiguity for
expansions beginning with "$((", which can introduce an arithmetic
expansion or a command substitution that starts with a subshell.
Arithmetic expansion has precedence; that is, the shell shall first
determine whether it can parse the expansion as an arithmetic
expansion and shall only parse the expansion as a command substitution
if it determines that it cannot parse the expansion as an arithmetic
expansion.  The shell need not evaluate nested expansions when
performing this determination.  If it encounters the end of input
without already having determined that it cannot parse the expansion
as an arithmetic expansion, the shell shall treat the expansion as an
incomplete arithmetic expansion and report a syntax error.  A
conforming application shall ensure that it separates the "$(" and '('
into two tokens (that is, separate them with white space) in a command
substitution that starts with a subshell.  For example, a command
substitution containing a single subshell could be written as:

$( (command) )"


Footnotes:
[1]  
https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_06_03




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

2024-02-09 Thread Thorsten Bonow

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:"



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

2024-02-09 Thread Michael Tokarev

09.02.2024 16:58, ca...@allfreemail.net

Package: console-setup
Followup-For: Bug #1063518

Consider making all scripts provided by console-setup shellcheck-clean, there 
are lots of tiny issues that can turn into big issues under the right 
conditions.


Please do not do this. Shellcheck is a huge problem and we had large amount
of bugs due to people trying to apply its suggestions.  It's very difficult
in many cases to spot why shellcheck is wrong (classic is the suggestion to
put $var into double quotes "$var" which breaks badly if $var is supposed to
contain zero or more separate words - this way, even boot scripts has become
buggy leading to system becoming unbootable).

Shellcheck is a very bad tool.

/mjt



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

2024-02-09 Thread cacin
Package: console-setup
Followup-For: Bug #1063518

Consider making all scripts provided by console-setup shellcheck-clean, there 
are lots of tiny issues that can turn into big issues under the right 
conditions.

https://tracker.debian.org/pkg/shellcheck



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

2024-02-09 Thread Sven Joachim
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 '))'
| $
`


-- System Information:
Debian Release: trixie/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (101, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386