Sean Palmer created RAT-582:
-------------------------------

             Summary: Scripts, batch files, and DTDs are never checked
                 Key: RAT-582
                 URL: https://issues.apache.org/jira/browse/RAT-582
             Project: Apache RAT
          Issue Type: Bug
          Components: mime-meta-data
    Affects Versions: 0.18
            Reporter: Sean Palmer


Files whose Tika media type is in the {{application/...}} tree are classified 
as BINARY unless listed in {{TikaProcessor.DOCUMENT_TYPE_MAP}}, so their 
license headers are never checked. This affects several common source formats:

* {{.sh}}, {{.bash}} ({{application/x-sh}})
* any file starting with a {{#\!/}} line whose interpreter Tika doesn't 
recognise by path, e.g. {{#\!/usr/bin/env python3}}, {{#\!/usr/bin/env perl}}, 
{{#\!/usr/bin/env node}}. Tika's {{application/x-sh}} magic on {{#\!/}} wins 
over the file name, so a {{.py}} file becomes {{application/x-sh}}
* {{.bat}}, {{.cmd}} ({{application/x-bat}})
* {{.dtd}} ({{application/xml-dtd}})

By contrast, {{#\!/usr/bin/python}} is detected as {{text/x-python}} and is 
checked.

Found while investigating 
https://github.com/apache/tooling-trusted-releases/issues/1725. Apache Trusted 
Releases runs RAT on uploaded source archives.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to