koalaman
Repos
16
Followers
663
Following
2

ShellCheck, a static analysis tool for shell scripts

31753
1542

The contents on linuxatemyram.com

292
27

Haskell implementation of gzip-compatible `pack` compression from the early 1980s

33
0

The source code for FiniteCurve.com

C
18
3

Events

issue comment
Binaries for solaris.

There are currently no official Solaris or Sparc binaries, no.

Have you tried Linux ABI compatibility on amd64? Outside of that and any unofficial binaries that may exist, I guess there's QEmu user emulation which works ok-ish if you restrict virtual memory via ulimit.

Created at 5 days ago
issue comment
Question: Docker Hub Free team sunset

I've applied for the Docker OSS program and will see what they say. Thanks for the poke!

Created at 1 week ago
closed issue
manpage -- args are shown as emdashes
$ shellcheck --version
ShellCheck - shell script analysis tool
version: 0.7.0
license: GNU General Public License, version 3
website: https://www.shellcheck.net

On Ubuntu, man shellcheck seems to have converted double-dash (--) args into em-dashes (or similar):

       –list-optional
              Output a list of known optional checks.  These can be enabled with -o flags or enable directives.

This seems incorrect:

$ shellcheck –list-optional
–list-optional: –list-optional: openBinaryFile: does not exist (No such file or directory)

vs double-dash:

$ shellcheck --list-optional
name:    add-default-case
desc:    Suggest adding a default case in `case` statements
example: case $? in 0) echo 'Success';; esac
fix:     case $? in 0) echo 'Success';; *) echo 'Fail' ;; esac
...
Created at 1 month ago
issue comment
manpage -- args are shown as emdashes

The issue was fixed upstream with #1392, and is reflected in v0.8.0 as packaged in ubuntu:22.10. I can reproduce the issue in Docker with ubuntu:20.04 though, and it is indeed annoying. If you want a backport to older Ubuntu packages, you'd have to file a bug on the Ubuntu side.

Created at 1 month ago
issue comment
Expired TLS certificate on shellcheck.net

Fixed again, thanks

Created at 1 month ago
closed issue
Certification expired

As an FYI, the certification expired.

Created at 1 month ago
issue comment
Certification expired

Fixed, thanks!

Created at 1 month ago
issue comment
winget

The only upstream packages are the raw binary releases, plus Hackage, Docker and Snap.

All the chocolatey, scoop, pip, brew, and myriad of distro packages are maintained by independent volunteers (thanks, folks!)

Created at 1 month ago
issue comment
Support fgl 5.8.1.0.

There's no formal extended test suite, but I like to diff the ShellCheck output on a few thousand random scripts. In this case I happened to have a /usr/src/linux-headers-5.15.0-46/tools/testing/selftests/net/icmp_redirect.sh from Ubuntu's linux-headers package that triggered the bug.

I also have a corpus of shell scripts scraped from GitHub, but didn't track the provenance. At some point I should try to scrape a set of BSD/GPL licensed ones and that I can put in a public repo as test data.

Created at 1 month ago
closed issue
Building for darwin.x86_64 fails with error building dependency "hashable-1.4.2.0"

Building linux.x86_64 is working well, but building for darwin is failing with the message below. As far as I understand, the Linux build succeeds because it's using GHC 9.x, but the Darwin build fails because it's still using GHC 8. I guess that the latest version of hashable is not compatible with GHC 8 anymore, but I'm clueless about Haskell and don't know how to fix this.

# ../build/run_builder ../source/source.tar.gz ../build/darwin.x86_64
# <snipped>
Starting     hashable-1.4.2.0 (lib)
Building     hashable-1.4.2.0 (lib)
Installing   fgl-5.8.1.0 (lib)
Completed    fgl-5.8.1.0 (lib)

Failed to build hashable-1.4.2.0.
Build log (
/root/.cabal/logs/ghc-8.10.4/hashable-1.4.2.0-4d9e24142c79d0837ac3fbcc917fe0906b6e75c1a9ba89dd21ef567cd22805ff.log
):
Configuring library for hashable-1.4.2.0..
Preprocessing library for hashable-1.4.2.0..
Building library for hashable-1.4.2.0..
[1 of 7] Compiling Data.Hashable.Imports ( src/Data/Hashable/Imports.hs, dist/build/Data/Hashable/Imports.o )
[2 of 7] Compiling Data.Hashable.LowLevel ( src/Data/Hashable/LowLevel.hs, dist/build/Data/Hashable/LowLevel.o )
ld: warning: directory not found for option '-F/System/Library/Frameworks/'
[3 of 7] Compiling Data.Hashable.Class ( src/Data/Hashable/Class.hs, dist/build/Data/Hashable/Class.o )

src/Data/Hashable/Class.hs:913:20: error:
    * Data constructor not in scope: I# :: t0 -> Int
    * Perhaps you meant `W#' (imported from GHC.Word)
      Perhaps you want to add `I#' to the import list in the import of
      `GHC.Base' (src/Data/Hashable/Class.hs:86:1-42).
    |
913 |         numBytes = I# (sizeofByteArray# ba)
    |                    ^^

src/Data/Hashable/Class.hs:913:24: error:
    * Variable not in scope: sizeofByteArray# :: ByteArray# -> t0
    * Perhaps you want to add `sizeofByteArray#'
      to one of these import lists:
        `GHC.Base' (src/Data/Hashable/Class.hs:86:1-42)
        `GHC.Prim' (src/Data/Hashable/Class.hs:89:1-41)
    |
913 |         numBytes = I# (sizeofByteArray# ba)
    |                        ^^^^^^^^^^^^^^^^
cabal: Failed to build hashable-1.4.2.0 (which is required by exe:shellcheck
from ShellCheck-0.9.0). See the build log above for details.


gzip: stdin: unexpected end of file
tar: Child returned status 1
tar: Error is not recoverable: exiting now
[jansorg@Island bin]$ ../build/run_builder ../source/source.tar.gz ../build/darwin.x86_64

Created at 1 month ago
issue comment
Building for darwin.x86_64 fails with error building dependency "hashable-1.4.2.0"

This appears to be a general issue with cross-compilation, affecting both linux.aarch64 and darwin.x86_64. I was able to upgrade to 9.2.5 for now, but it required mixing and matching newer GHC host builds with older versions of the llvm and gcc toolchains, so it's not particularly future proof.

Since GHC cross-compilation is not well exercised, they'll probably have to move towards emulation in the future.

Created at 1 month ago

Count CFEExit as control flow for the purposes of finding dominators

Upgrade cross-compilers to 9.2.5 to handle hashable-1.4.2.0

Created at 1 month ago
pull request closed
Support fgl 5.8.1.0.

ShellCheck used to rely on a bug in Data.Graph.Inductive.Query.Dominators.dom where a node not reachable from the root would be considered dominated by every node in the graph.

This commit restores that functionality, and is therefore compatible with both fgl 5.8.1.0 and previous versions.

Fixes #2677.

Created at 1 month ago
issue comment
Support fgl 5.8.1.0.

Thanks for debugging this! You're right about the root cause of this failing test, but unfortunately the fgl diff that changed this behavior also introduced a crash bug, so 5.8.1.0 still isn't compatible. I filed https://github.com/haskell/fgl/issues/109

Created at 1 month ago
issue comment
prop_checkOverwrittenExitCode8 fails with fgl-5.8.1.0

The behavior of dominator searches have changed, and fgl now crashes in some cases. I've restricted the package bounds on Hackage and git, and filed https://github.com/haskell/fgl/issues/109

Created at 1 month ago
opened issue
5.8.1.0 crashes when computing dominators in graphs with unreachable nodes

When computing dominators for connected, directed graphs, 5.8.1.0 crashes when it encounters nodes not reachable from the root. Here's a MCVE:

import Data.Graph.Inductive.Graph
import Data.Graph.Inductive.Query.Dominators
import Data.Graph.Inductive.PatriciaTree

main = do
    -- The graph  1 -> 2 <- 3
    let graph = mkGraph [(1,()), (2, ()), (3, ())] [(1,2,()), (3,2,())] :: Gr () ()
    -- 5.8.0.0: [(1,[1]),(2,[2,1]),(3,[1,2,3])]
    -- 5.8.1.0: Exception: IntMap.!: key 3 is not an element of the map
    print $ dom graph 1

The issue appears to have been introduced in c8f56c18.

Created at 1 month ago

Update changelog from release

Remove fgl-5.8.1.0 as a dependency

ShellCheck is temporarily broken by https://github.com/haskell/fgl/commit/c8f56c18242b0c3e916892c5db56a609ec396637

Created at 1 month ago
closed issue
local

For bugs

  • Rule Id (if any, e.g. SC1000):
  • My shellcheck version (shellcheck --version or "online"):
  • [ ] The rule's wiki page does not already cover this (e.g. https://shellcheck.net/wiki/SC2086)
  • [ ] I tried on https://www.shellcheck.net/ and verified that this is still a problem on the latest commit

For new checks and feature suggestions

  • [ ] https://www.shellcheck.net/ (i.e. the latest commit) currently gives no useful warnings about this
  • [ ] I searched through https://github.com/koalaman/shellcheck/issues and didn't find anything related

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


#!/your/interpreter
your script here

Here's what shellcheck currently says:

Here's what I wanted or expected to see:

Created at 2 months ago
closed issue
ShellCheck fails to run using pre-commit (Debian-based distro/shell: bash)

For bugs

  • Rule Id (if any, e.g. SC1000): n/a
  • My shellcheck version (shellcheck --version or "online"): 0.9.0
  • [X] The rule's wiki page does not already cover this (e.g. https://shellcheck.net/wiki/SC2086)
  • [X] I tried on https://www.shellcheck.net/ and verified that this is still a problem on the latest commit

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


# .pre-commit-config.yaml
repos:
-   repo: https://github.com/koalaman/shellcheck-precommit
    rev: v0.9.0
    hooks:
    -   id: shellcheck
#       args: ["--severity=warning"]  # Optionally only show errors and warnings

Here's what shellcheck currently says:

$ pre-commit run                                                18:00:00 Mon 26
ShellCheck v0.9.0........................................................Failed
- hook id: shellcheck
- exit code: 1

Executable `docker` not found

Here's what I wanted or expected to see:

Created at 2 months ago
issue comment
ShellCheck fails to run using pre-commit (Debian-based distro/shell: bash)

pre-commit hooks are expected to be cross-platform. Here's a list of languages/runners support by pre-commit, which includes things like python, lua, and node, and docker_image. The latter is really the only one that can run a Haskell program in a portable way. pre-commit implements this by assuming you already have Docker installed, which is an understandable concession.

You can have a look at this third-party hook instead, which even predates the official one: https://github.com/shellcheck-py/shellcheck-py . It uses the Python runner with a wrapper that downloads an appropriate binary for the current platform.

Created at 2 months ago
Created at 2 months ago
issue comment
shellcheck v0.9.0 will keep eating ram until a segfault or a system lockup

This is undoubtedly due to ShellCheck's new data flow analysis engine. It takes great care to be acceptably fast even for larger scripts, but 22,000 lines is something else. Given the amount of optimization work that went into it in the first place, I'm guessing the most realistic solution is a flag that disables DFA and either skips those checks or reverts to the old, naive algorithm.

Created at 2 months ago