Bug#880950: shellcheck: Incorrect parsing of default value in variable

Martin Schwenke martin at meltin.net
Mon Nov 6 06:32:52 UTC 2017


Package: shellcheck
Version: 0.4.6-1
Severity: normal
Tags: upstream patch

Dear Maintainer,

Here's a snippet or screenshot that shows the problem:

#!/bin/sh
b=$(d=$(dirname "$0") ; cd -P "$d" || exit ; dirname "$PWD")
bar="${FOOBAR:-${b}/foobar.d}"
echo "$bar"

Here's what shellcheck currently says:

In foo.sh line 2:
b=$(d=$(dirname "$0") ; cd -P "$d" || exit ; dirname "$PWD")
^-- SC2030: Modification of d is local (to subshell caused by $(..)
expansion).

In foo.sh line 3:
bar="${FOOBAR:-${b}/foobar.d}"
^-- SC2031: d was modified in a subshell. That change might be lost.

Here's what I wanted or expected to see:

Nothing!

For more details please see shellcheck issue #950 at:

  https://github.com/koalaman/shellcheck/issues/950

This is fixed upstream though there is no release yet.  The patch is
at:

  https://github.com/koalaman/shellcheck/commit/807d899f3b6139a61b644420d3f74b21bb0fb272

This is a regression to version 0.4.4, so I'm wondering if you could
apply this patch to fix the regression until there's a new shellcheck
release.

Thanks!

peace & happiness,
martin

-- System Information:
Debian Release: buster/sid
  APT prefers testing
  APT policy: (990, 'testing'), (990, 'stable'), (500,
'stable-updates'), (300, 'unstable') Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.13.0-1-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_AU.UTF-8, LC_CTYPE=en_AU.UTF-8 (charmap=UTF-8),
LANGUAGE=en_AU:en (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages shellcheck depends on:
ii  libc6     2.24-17
ii  libffi6   3.2.1-6
ii  libgmp10  2:6.1.2+dfsg-1.1

shellcheck recommends no packages.

shellcheck suggests no packages.

-- no debconf information



More information about the Pkg-haskell-maintainers mailing list