NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

bin/44347: sh does not respect editrc



>Number:         44347
>Category:       bin
>Synopsis:       sh does not respect editrc
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Jan 08 09:20:00 +0000 2011
>Originator:     Julio Merino
>Release:        NetBSD 5.99.43
>Organization:
Julio Merino
>Environment:
        
        
System: NetBSD blackbird 5.99.43 NetBSD 5.99.43 (GENERIC) #0: Fri Jan  7 
23:25:13 GMT 2011  
jmmv@blackbird:/home/jmmv/os/netbsd/obj.i386/home/jmmv/os/netbsd/src/sys/arch/i386/compile/GENERIC
 i386
Architecture: i386
Machine: i386
>Description:
        /bin/sh does not respect the editing mode set in ~/.editrc (nor it
        does respect whether editing is enabled/disabled at all).

        The problem is that sh will only enable editing if set -V or set -E
        are specified, defaulting to editing disabled otherwise.
>How-To-Repeat:
        Add 'bind -v' to ~/.editrc.
        Start 'ENV= /bin/sh'.
        Type 'set -o' and see how /bin/sh completely ignored you.

        You may also try to rebind ^I in ~/.editrc and later notice that your
        binding disappears in sh.
>Fix:
        I certainly do not understand why on earth we want to start the shell
        with editing disabled -- after all, if it was built against libedit
        (i.e. !SMALL) we may as well use it when we are interactive.

        So the fix is easy: at startup, load ~/.editrc and set the internal
        values of Vflag and Eflag depending on what the editing mode for
        libedit is (use el_get to query EL_EDITOR and EL_EDITMODE).  *Then*
        override those with any -V or -E flag that the user may have given.

        If the user wants to disable editing for whatever reason, he should
        still be able to do so by doing set +V or set +E... but starting with
        editing enabled by default makes things much easier.

        In other words: the defaults for the interactive shell should be those
        provided by ~/.editrc or, if not present, those built in into libedit.
        It is up to the user to later override these values by either selecting
        a particular editing mode or disabling it altogether.

>Unformatted:
        
        


Home | Main Index | Thread Index | Old Index