Shell detection fails

Bug #1234435 reported by Marco Patzer on 2013-10-02
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
UltiSnips
Fix Committed
Undecided
Unassigned

Bug Description

When opening up a shell script and write `#!` and expand that snippet, it is expanded to `#!/bin/ksh` although I run a POSIX shell. I assume the test in `getShell` is wrong. `g:is_posix` is set, not `g:is_sh`. At the moment there is:

    def getShell():
        for scope in ["g", "b"]:
           for shell in ["bash", "sh", "kornshell"]:
                if testShell(scope, shell) == "1":
                    if shell == "kornshell":
                        return "ksh"
                    return shell
       return "sh"
    endglobal

When this is changed to the following the POSIX shell is correctly detected and `#!/bin/sh` is printed.

    def getShell():
        for scope in ["g", "b"]:
            for shell in ["bash", "posix", "kornshell"]:
                if testShell(scope, shell) == "1":
                    if shell == "kornshell":
                        return "ksh"
                    elif shell == "posix":
                        return "sh"
                    return shell
        return "sh"
    endglobal

2.7.5+ (default, Sep 17 2013, 15:33:59)
[GCC 4.8.1]
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Sep 17 2013 12:41:12)
Included patches: 1-27

SirVer (sirver) wrote :

Thanks for the patch. I pushed it right now.

Changed in ultisnips:
status: New → Fix Committed
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers