bin/170651: On 9.0-RELEASE#0 and master sh(1) gobbles high bit at first

Steffen Daode Nurpmeso sdaoden at
Wed Aug 15 15:10:10 UTC 2012

>Number:         170651
>Category:       bin
>Synopsis:       On 9.0-RELEASE#0 and master sh(1) gobbles high bit at first
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Aug 15 15:10:09 UTC 2012
>Originator:     Steffen "Daode" Nurpmeso
>Release:        9.0-REALEASE, and git master branch
Hm, i was a bit late yesterday and am subscribed to no list
around here which seemed to be sufficient, so i've subscribed
to bugs@ and confirmed and send my mail.
It seems this list is usually driven by a tracker..
So, then.

If /bin/sh is the login shell, starting it won't allow input of
german umlauts in ISO8859-15 locale with fonts plus well set up.
Issue a set with arguments ($set +o, $set -o), and it'll work
as expected.
Start a shell.
So it turns out the problem is the histedit() function.
If it isn't called from within optschanged() then everything is fine.

Now i've spend some hours trying to adjust that, but i've no idea
on sh(1) and libedit(3) internals, so i still don't understand the
problem, though i've found a getaround.

The problem occurs when 'el' must be initialized.  If that actually
happens (upon sh(1) startup), then it'll change handling of the high
bit (or say, i'm just fiddling around with german umlauts here).
I've split up histedit() in individual parts, i've used sleeps and
recursive calls and whatever, but it didn't help.
The only solution i've found is to call histedit() from within main()
again (or outsource the pure initialization code to histedit_init(),
but anyway call it once from within main()).

I've no idea if that may have side-impacts, but applying the patch
fixes the issue for me.
This patch applies to the master branch of git://

So sorry for the mail yesterday.
And how can i Cc: jilles@ and pfg@ from within this tracker now??


Patch attached with submission follows:

diff --git a/bin/sh/main.c b/bin/sh/main.c
index 5eb12e0..99f9d5e 100644
--- a/bin/sh/main.c
+++ b/bin/sh/main.c
@@ -73,6 +73,9 @@ __FBSDID("$FreeBSD$");
 #include "exec.h"
 #include "cd.h"
 #include "builtins.h"
+#ifndef NO_HISTORY
+# include "myhistedit.h"
 int rootpid;
 int rootshell;
@@ -164,6 +167,11 @@ state2:
+	/* Fix issue with gobbled high bits */
+#ifndef NO_HISTORY
+	if (iflag)
+		histedit();
 	state = 4;


More information about the freebsd-bugs mailing list