openBinaryFile: does not exist (No such file or directory) when using shellcheck

Viewed 1071

I am seeing this issue, on Ubuntu 18.04.4 LTS for shellcheck:

$ ls -l /data/myscript
-rwxr-xr-x 1 user 1300000013 4200 Aug 25 13:13 /data/myscript
$ shellcheck /data/myscript
/data/myscript: /data/myscript: openBinaryFile: does not exist (No such file or directory)

Why the error?

1 Answers

I found the answer by reviewing https://github.com/koalaman/shellcheck/issues/1356

The issue in my case was that snap blocked access to /data (snap sandboxes things so it cannot access files outside of home and /media), so a simple:

mv /data/myscript ~  # Move the script to homedir
shellcheck ~/myscript

Made shellcheck work normally.

Related