Open anadon opened 1 week ago
This is indeed a good idea. There is the --skip-nosh
flag that does something similar, but not quite what you are looking for. It looks pretty ad-hoc anyways, so it would make sense to replace it by a better way to declare how one wants to handle shebangs.
If you could point me in the right direction, I'll try to take it from there.
I wasn't the instigator of the --skip-nosh
option, but I would say the best start is to look how it is implemented. As a first idea, I would say that we probably need two options, one to say how to reject files (the current --skip-nosh
option and what you suggest) and one to say what to do to rejected files (skip
or fail
, I suppose). Maybe:
--shebangs-recognition
which can be none
, only-sh
, reject-nosh
(default to none
)--shebangs-recognition-strictness
which can be skip
or fail
(default to fail
would make sense imo)(I'm not very good at naming, so feel free to suggest other things!)
Recognizing shebangs ( #!/usr/bin/sh or #! /usr/bin/env sh or similar ) can be used with a word splitting pattern match to make sure to match the shell being invoked is supported by Morbig.