[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: bin/44347: sh does not respect editrc
The following reply was made to PR bin/44347; it has been noted by GNATS.
From: Julio Merino <jmmv%NetBSD.org@localhost>
Cc: gnats-admin%netbsd.org@localhost, netbsd-bugs%netbsd.org@localhost
Subject: Re: bin/44347: sh does not respect editrc
Date: Sat, 8 Jan 2011 16:13:45 +0000
On Sat, Jan 8, 2011 at 2:10 PM, David Laight <david%l8s.co.uk@localhost> wrote:
> The following reply was made to PR bin/44347; it has been noted by GNATS.
> From: David Laight <david%l8s.co.uk@localhost>
> To: gnats-bugs%NetBSD.org@localhost
> Subject: Re: bin/44347: sh does not respect editrc
> Date: Sat, 8 Jan 2011 14:12:56 +0000
> =A0On Sat, Jan 08, 2011 at 09:20:01AM +0000, jmmv%netbsd.org@localhost wrote:
> =A0> >Number: =A0 =A0 =A0 =A0 44347
> =A0> >Category: =A0 =A0 =A0 bin
> =A0> >Synopsis: =A0 =A0 =A0 sh does not respect editrc
> =A0> System: NetBSD blackbird 5.99.43 NetBSD 5.99.43 (GENERIC) #0: Fri Ja=
n =A07 23:25:13 GMT 2011 =A0jmmv@blackbird:/home/jmmv/os/netbsd/obj.i386/ho=
> =A0> Architecture: i386
> =A0> Machine: i386
> =A0> >Description:
> =A0> =A0 =A0 =A0/bin/sh does not respect the editing mode set in ~/.editr=
c (nor it
> =A0> =A0 =A0 =A0does respect whether editing is enabled/disabled at all).
> =A0> =A0 =A0 =A0The problem is that sh will only enable editing if set -V=
or set -E
> =A0> =A0 =A0 =A0are specified, defaulting to editing disabled otherwise.
> =A0That is the way it needs to be :-)
> =A0The edit mode for a shell comes from the shells initialisation files.
> =A0I'm not rure how you reconcile this with setup from .editrc, particula=
> =A0since the effect of switching the shell between 'vi' and 'emacs' line
> =A0editing has to work correctly - even though the .editrc mappings can
> =A0only (probably) apply to one of the modes.
I guess it could work like this:
1) sh explicitly disables editing after el_init.
2) sh loads editrc with el_source.
3) If editrc enabled editing and/or set the editing mode explicitly,
sh deduces the initial value of its own vi/emacs variables.
4) If the user specified -V, +V, -E or +E, the libedit state is
bash does something similar.
> =A0filename completion is, in patticular, a double edged sword.
> =A0I don't necessarily enable it, I type <tab> chars inside commands and
> =A0filename completetion makes that a PITA (it really ought to be disable=
> =A0inside single quotes).
> =A0Command name completion is even more problematical, since it causes co=
> =A0network delays if any of your path references a network filesystem.
> =A0Then we get the versions that use CDPATH when completing for 'cd' - wh=
> =A0is again a pita.
Sure, this is the "normal" behavior of the autocompletion. I am not
saying that tab completion should be enabled by default. I am just
saying that if a user sets whatever binding for ^I they want in
.editrc, sh will silently ignore it.
> =A0> =A0 =A0 =A0In other words: the defaults for the interactive shell sh=
ould be those
> =A0> =A0 =A0 =A0provided by ~/.editrc or, if not present, those built in =
> =A0> =A0 =A0 =A0It is up to the user to later override these values by ei=
> =A0> =A0 =A0 =A0a particular editing mode or disabling it altogether.
> =A0The presence of libedit shouldn't affect the shell.
> =A0The shell uses libedit to implement it's own command editing.
So, then, why is sh reading .editrc *at all*? It seems to only cause
problems and getting it to "work right" (whatever that means, as I'm
not even sure) is non-trivial and surely controversial.
Main Index |
Thread Index |