fix(discover): detect extensionless scripts by shebang#1203
Open
ibaldr89 wants to merge 1 commit into
Open
Conversation
Signed-off-by: ibaldr89 <163388887+ibaldr89@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
/usr/bin/envandenv -Sfor common supported scripting languagesFixes #1199
Why
Executable source scripts commonly omit a filename extension. Before this change, files such as:
were silently absent from the graph even though Python is supported. Full indexing did not change that because language detection was filename-only.
Behavior
Existing detection remains authoritative. Shebang detection runs only when
cbm_language_for_filename()returnsCBM_LANG_COUNT.Supported interpreter basenames:
python,python2,python3, dotted numeric versions such aspython3.12sh,bash,dash,ksh,zshnode,nodejsruby,perl,php,luaThe probe reads at most 255 bytes plus one EOF/truncation probe byte, rejects embedded NUL, read errors, overlong first lines, unsupported
envoption/assignment shapes, and arbitrary prefix matches such aspython-wrapper.Related work checked
No existing issue or PR found in the checked open/closed history implements shebang-based language fallback for extensionless source files.
Testing
Full suite comparison in the same isolated Docker environment:
main: 6180 passed, 0 failedtests/test_httpd.c:358; no candidate-only failure was introduced