Conversation
|
I know libmagic is annoying to use in containers, but especially for detecting shell scripts, its very advanced. Shipping our own implementation might be a step back and still opens a can of worms from a maintenance POV. In an other project, i moved to puremagic and never had any issues. This was for detecting media files, though, which is much simpler. Did you give that a try? |
d399f64 to
cc91863
Compare
|
It makes sense to check puremagic |
|
I checked and puremagic does not currently support recognizing shell scripts at all - they're all reported as "plain text". In theory shell script support could be added. But the puremagic 2.* branch also dropped support for python<3.12 which coverage-sh support. I think carrying the code to recognize shell scripts inside coverage-sh itself is not unreasonable - it's a small amount of code and tightly connected to functionality. |
cc91863 to
fce8cc5
Compare
|
Cleaned up some of the AI slop in the first version. |
The python-magic package depends on the native libmagic library. This dependency needs to be added in containers and such.
Replace
import magicwith manual checks based on filename extension and header.If people have trouble with auto-detect logic the best bet would be to add a shebang, even for non-executable library files. This is also used by shellcheck.