Date: Wed, 29 Aug 2012 10:30:06 GMT From: Steffen "Daode" Nurpmeso <sdaoden@gmail.com> To: freebsd-bugs@FreeBSD.org Subject: Re: bin/170651: On 9.0-RELEASE#0 and master sh(1) gobbles high bit at first Message-ID: <201208291030.q7TAU6qJ050319@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/170651; it has been noted by GNATS. From: Steffen "Daode" Nurpmeso <sdaoden@gmail.com> To: Jilles Tjoelker <jilles@stack.nl> Cc: bug-followup@FreeBSD.org Subject: Re: bin/170651: On 9.0-RELEASE#0 and master sh(1) gobbles high bit at first Date: Wed, 29 Aug 2012 12:24:11 +0200 This is a multi-part message in MIME format. --=_503dedcb.nteIZRWEG6EbH/vp9TUbaaUn9m8DsADejmyTkwQSsrStVaAf Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Content-Disposition: inline Jilles Tjoelker <jilles@stack.nl> wrote: |This PR bin/170651 does in fact look valid. It looks like libedit only |partially picks up an LC_CTYPE change. Whether it shows '\OOO' or real |characters with bit 7 set changes immediately; whether it accepts |characters with bit 7 set changes only after doing something that causes |libedit to be reinitialized (such as 'set +o'). | |This is probably a bug in libedit and/or sh's use of it, although there |are bigger bugs in libedit and sh's use of it. | |-- |Jilles Tjoelker As all locale changes effectively boil down in var.c:{update,init}charset(), either call histedit() in updatecharset(), which is what the first (-easy) diff does, or introduce a new function which only performs the necessary libedit call-in to update the mapping (second patch, -harder). Since histedit() always causes a reparse of editrc(5) (and AFAIU), i would vote for the harder patch :) Thanks and ciao, --steffen --=_503dedcb.nteIZRWEG6EbH/vp9TUbaaUn9m8DsADejmyTkwQSsrStVaAf Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="pr_bin_170651-easy.diff" diff --git a/bin/sh/var.c b/bin/sh/var.c index 6041459..ccbb5d7 100644 --- a/bin/sh/var.c +++ b/bin/sh/var.c @@ -515,6 +515,7 @@ bltinunsetlocale(void) /* * Update the localeisutf8 flag. + * And force reinitialization of libedit's key mappings (PR bin/170651). */ void updatecharset(void) @@ -523,6 +524,9 @@ updatecharset(void) charset = nl_langinfo(CODESET); localeisutf8 = !strcmp(charset, "UTF-8"); +#ifndef NO_HISTORY + histedit(); +#endif } void --=_503dedcb.nteIZRWEG6EbH/vp9TUbaaUn9m8DsADejmyTkwQSsrStVaAf Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="pr_bin_170651-harder.diff" diff --git a/bin/sh/histedit.c b/bin/sh/histedit.c index 6371599..069ac04 100644 --- a/bin/sh/histedit.c +++ b/bin/sh/histedit.c @@ -158,6 +158,16 @@ bad: } } +void +hist_on_lc_change(void) +{ + if (iflag && editing) { + if (el) + el_set(el, EL_EDITOR, Vflag ? "vi" : "emacs"); + else + histedit(); + } +} void sethistsize(const char *hs) diff --git a/bin/sh/myhistedit.h b/bin/sh/myhistedit.h index e31276d..3193a09 100644 --- a/bin/sh/myhistedit.h +++ b/bin/sh/myhistedit.h @@ -37,6 +37,7 @@ extern EditLine *el; extern int displayhist; void histedit(void); +void hist_on_lc_change(void); void sethistsize(const char *); void setterm(const char *); diff --git a/bin/sh/var.c b/bin/sh/var.c index 6041459..8f019bf 100644 --- a/bin/sh/var.c +++ b/bin/sh/var.c @@ -515,6 +515,7 @@ bltinunsetlocale(void) /* * Update the localeisutf8 flag. + * And force reinitialization of libedit's key mappings (PR bin/170651). */ void updatecharset(void) @@ -523,6 +524,9 @@ updatecharset(void) charset = nl_langinfo(CODESET); localeisutf8 = !strcmp(charset, "UTF-8"); +#ifndef NO_HISTORY + hist_on_lc_change(); +#endif } void --=_503dedcb.nteIZRWEG6EbH/vp9TUbaaUn9m8DsADejmyTkwQSsrStVaAf--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201208291030.q7TAU6qJ050319>