Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 15 Aug 2012 15:03:21 GMT
From:      Steffen "Daode" Nurpmeso <sdaoden@gmail.com>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   bin/170651: On 9.0-RELEASE#0 and master sh(1) gobbles high bit at first
Message-ID:  <201208151503.q7FF3LaG088361@red.freebsd.org>
Resent-Message-ID: <201208151510.q7FFA9T0055584@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>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
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Aug 15 15:10:09 UTC 2012
>Closed-Date:
>Last-Modified:
>Originator:     Steffen "Daode" Nurpmeso
>Release:        9.0-REALEASE, and git master branch
>Organization:
>Environment:
>Description:
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.
>How-To-Repeat:
Start a shell.
>Fix:
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://git.freebsd.org/freebsd.

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

--steffen

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"
+#endif
 
 int rootpid;
 int rootshell;
@@ -164,6 +167,11 @@ state2:
 			read_profile(shinit);
 		}
 	}
+	/* Fix issue with gobbled high bits */
+#ifndef NO_HISTORY
+	if (iflag)
+		histedit();
+#endif
 state3:
 	state = 4;
 	popstackmark(&smark2);


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201208151503.q7FF3LaG088361>