Open contivero opened 5 years ago
After opening this and uploading a fix to my fork, I realized it might not be the appropriate way (you can check it here). I approched it as the other similar fixes I did, but this one is not technically a bashism (GNUism?), so I'm not sure if I should leave it inside ShellSupport.hs, or if I should move it to the Commands.hs file.
Like you say, bad flags to export
, ulimit
and other builtins are a bashism or shell support issue, while this is a more general userland issue. ShellCheck is currently only aware of which shell you're targeting, it doesn't know which userland.
The shell and userland are not necessarily connected:
There's not currently any support for trying to check whether e.g. a GNU/Linux script will run on macOS. This would be nice and has been briefly discussed a few times before (e.g. #674), but it's not currently supported and there's quite a few details to be worked out.
I'll focus on builtins then. You may close this, or leave it open in case it is eventually supported, however you see fit. Thanks for the detailed explanation! 🙂
For new checks and feature suggestions
Here's a snippet or screenshot that shows the problem:
Here's what shellcheck currently says:
No issues detected!
Here's what I wanted or expected to see:
"In POSIX sh, rmdir flags besides -p are undefined"
The only acceptable flag for
rmdir
under POSIX sh is-p
(see spec),--parent
is a GNU synonym for-p
not defined by POSIX. There are other flags defined by GNU'srmdir
(such as--ignore-fail-on-non-empty
) which are also not POSIX.