app: when interpreter not found in interpreter DB, leave shebang as-is.

In particular, if the shebang is `#!/usr/bin/env lang` and we have not
registered a specific interpreter for `lang`, the system should leave
the env tool search the right interpreter for us. We only bypass env
when we set our own explicit interpreter.

(cherry picked from commit 9e844ae1d7)

Slight modification from master commit: not applying to
palette-to-gradient.py plug-in.
This commit is contained in:
Jehan
2019-07-29 14:01:46 +02:00
parent c860d62a63
commit 0b49a26d6a

View File

@ -721,14 +721,22 @@ resolve_sh_bang (GimpInterpreterDB *db,
{
if (strcmp ("/usr/bin/env", name) == 0)
{
/* Shift program name and arguments to the right. */
name = cp;
program = g_hash_table_lookup (db->programs, cp);
for ( ; *cp && (*cp != ' ') && (*cp != '\t'); cp++)
;
if (program)
{
/* Shift program name and arguments to the right, if and
* only if we recorded a specific interpreter for such
* script. Otherwise let `env` tool do its job.
*/
name = cp;
while ((*cp == ' ') || (*cp == '\t'))
*cp++ = '\0';
for ( ; *cp && (*cp != ' ') && (*cp != '\t'); cp++)
;
while ((*cp == ' ') || (*cp == '\t'))
*cp++ = '\0';
}
}
if (*cp)