4 ms·
- This fails on badly formed PATH, or malicious PATH - When PATH contains entries that no longer exist / are not mounted, substitution with "sed" gives a wildc
by junke 6y ago
- This fails on badly formed PATH, or malicious PATH
- When PATH contains entries that no longer exist / are not mounted, substitution with "sed" gives a wildcard that is not expanded, and eventually makes "file" report an error, which is not filtered out
- If PATH contains entries that have spaces, the expansion is incorrect
- enriquto 6y agoMore realistically, it also fails if you have directories on your path that are symlinks to other directories in the path. In that case their programs are doubly-counted. Anyways, if your PATH is malicious then you have worse problems than this silly script :)
- JdeBP 6y agoYour error is in thinking that either of those cases is in any way malice.
- junke 6y agoI agree, but "more realistically"? those cases were pretty realistic I think. If you run the script on a box where you have users who can do whatever they want, at least the script should fail on bad inputs. PATH=rm -rf :/bin