From nobody@FreeBSD.org  Fri Dec  6 08:04:31 2013
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115])
	(using TLSv1 with cipher ADH-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by hub.freebsd.org (Postfix) with ESMTPS id D70D979C
	for <freebsd-gnats-submit@FreeBSD.org>; Fri,  6 Dec 2013 08:04:31 +0000 (UTC)
Received: from oldred.freebsd.org (oldred.freebsd.org [8.8.178.121])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by mx1.freebsd.org (Postfix) with ESMTPS id BE260160D
	for <freebsd-gnats-submit@FreeBSD.org>; Fri,  6 Dec 2013 08:04:19 +0000 (UTC)
Received: from oldred.freebsd.org ([127.0.1.6])
	by oldred.freebsd.org (8.14.5/8.14.7) with ESMTP id rB684HPi006485
	for <freebsd-gnats-submit@FreeBSD.org>; Fri, 6 Dec 2013 08:04:17 GMT
	(envelope-from nobody@oldred.freebsd.org)
Received: (from nobody@localhost)
	by oldred.freebsd.org (8.14.5/8.14.5/Submit) id rB67skjt018298;
	Fri, 6 Dec 2013 07:54:46 GMT
	(envelope-from nobody)
Message-Id: <201312060754.rB67skjt018298@oldred.freebsd.org>
Date: Fri, 6 Dec 2013 07:54:46 GMT
From: Yuri <yuri@rawbw.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: Sync of libedit with upstream NetBSD
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         184533
>Category:       kern
>Synopsis:       [libedit] [patch] Sync of libedit with upstream NetBSD
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    pfg
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          update
>Submitter-Id:   current-users
>Arrival-Date:   Fri Dec 06 08:10:00 UTC 2013
>Closed-Date:    Thu Dec 26 01:18:16 UTC 2013
>Last-Modified:  Thu Dec 26 01:18:16 UTC 2013
>Originator:     Yuri
>Release:        
>Organization:
n/a
>Environment:
>Description:
This is the update of libedit from NetBSD upstream.

Please note the file renames: term.* => terminal.*, key.* => keymacro.*
Also files eln.c, chartype.c and config.h are added.

libedit now can be built with the option WIDECHAR. FreeBSD will build it with this option, allowing libedit to process international characters.

Please note that with the option WIDECHAR NetBSD code checks for __STDC_ISO_10646__ define. This is checking for one specific encoding UCS, which is wrong IMO since wchar_t can represent any encoding. This define isn't defined on FreeBSD, and I disabled this check.

There is also port devel/libedit, which is exactly the same as libedit. It is built from the blob extracted from NetBSD for linux. I suggest this port (devel/libedit) is deleted.

>How-To-Repeat:

>Fix:
patch is here: http://yv.dynalias.com:8085/libedit.patch
(delphij -- local mirror: http://people.freebsd.org/~delphij/misc/libedit-pr184533.patch )

>Release-Note:
>Audit-Trail:

From: Yuri <yuri@rawbw.com>
To: bug-followup@FreeBSD.org
Cc:  
Subject: RE: kern/184533: [libedit] [patch] Sync of libedit with upstream
 NetBSD
Date: Fri, 06 Dec 2013 12:09:18 -0800

 The easiest way to apply the patch is to first move the following files 
 in repository:
 cd lib/libedit
 svn mv term.c terminal.c
 svn mv term.h terminal.h
 svn mv key.c keymacro.c
 svn mv key.h keymacro.h
 
Responsible-Changed-From-To: freebsd-bugs->pfg 
Responsible-Changed-By: delphij 
Responsible-Changed-When: Fri Dec 6 20:19:56 UTC 2013 
Responsible-Changed-Why:  
Hi, Pedro, 

Can you take a look at this one? 

Cheers, 

http://www.freebsd.org/cgi/query-pr.cgi?pr=184533 

From: Jilles Tjoelker <jilles@stack.nl>
To: Yuri <yuri@rawbw.com>
Cc: bug-followup@FreeBSD.org
Subject: Re: kern/184533: [libedit] [patch] Sync of libedit with upstream
 NetBSD
Date: Sat, 7 Dec 2013 00:55:52 +0100

 On Fri, Dec 06, 2013 at 12:10:09PM -0800, Yuri wrote:
 > I created a patch for this. libedit hasn't been updated for 4+ years
 > http://www.freebsd.org/cgi/query-pr.cgi?pr=184533
 
 > Please MFC to 10.
 
 I did a quick test and it does not fix PR bin/169773, although the
 behaviour is different. A resize in sh now discards the current line and
 prints a new prompt, rather than potentially repeating editing
 operations such as backspace.
 
 Another issue: typing "bind" in sh causes a segfault with the patch.
 Formerly, it did not segfault but returned output containing many
 obviously wrong lines such as "\777" -> ed-quoted-insert (how do I type
 a 9-bit byte?) and "^" -> ed-argument-digit (apparently, esc then 0 is
 meant).
 
 Another issue also still persists, which I have not reported before
 although it contributes to the flaky feeling of libedit I have mentioned
 before: long lines are sometimes drawn incorrectly. For me (80 char wide
 terminal), this happens when inserting text at the start of about 160
 letters of content (which therefore spans three screen lines). At some
 point, libedit displays whitespace instead of some of the proper
 content. Ctrl+R causes a proper redisplay. Sometimes, the cursor
 position is incorrect as well and Ctrl+R moves the whole content up a
 screen line.
 
 I think the display on multiple screen lines is very useful (mksh does
 not have it, for example), but these bugs detract from it.
 
 The __STDC_ISO_10646__ check in the NetBSD code is indeed wrong because
 it is too strong. In FreeBSD, wchar_t 0..127 are ASCII-compatible as
 libedit expects, but 128 and higher may have different encoding.
 
 The patch also reverts local changes to filename completion for sh that
 were originally applied in SVN r209217, r209219 and r209224. Without
 these changes, special characters are not quoted in completion results.
 However, if keeping this change is the only thing that prevents fixing
 the other bugs, it's acceptable to me to break this for a while.
 
 I disagree with removing the devel/libedit port just because it is "the
 same" as base libedit. The port may have a newer version than base and
 has different goals (staying close to upstream rather than working well
 with the programs in base).
 
 -- 
 Jilles Tjoelker

From: Yuri <yuri@rawbw.com>
To: Jilles Tjoelker <jilles@stack.nl>
Cc: bug-followup@FreeBSD.org
Subject: Re: kern/184533: [libedit] [patch] Sync of libedit with upstream
 NetBSD
Date: Fri, 06 Dec 2013 16:03:16 -0800

 On 12/06/2013 15:55, Jilles Tjoelker wrote:
 > The patch also reverts local changes to filename completion for sh that
 > were originally applied in SVN r209217, r209219 and r209224. Without
 > these changes, special characters are not quoted in completion results.
 > However, if keeping this change is the only thing that prevents fixing
 > the other bugs, it's acceptable to me to break this for a while.
 
 Ok, Pedro Guffini already noted that FreeBSD had some fixes in their 
 branch. I will extract the diffs that were added in FreeBSD line, and 
 create corresponding patches on top of this one, will add them to this 
 PR. Will also submit them to NetBSD.
 
 Yuri

From: Pedro Giffuni <pfg@FreeBSD.org>
To: Jilles Tjoelker <jilles@stack.nl>, bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/184533: [libedit] [patch] Sync of libedit with upstream
 NetBSD
Date: Fri, 06 Dec 2013 19:14:08 -0500

 I basically concur with Jilles' assessment:
 
 I did a preliminary attempt to update libedit some weeks ago and I 
 noticed many problems with bin/sh.
 
 I think I would prefer if the libedit port/package were updated first 
 and the problems there fixed.
 
 Pedro.
State-Changed-From-To: open->closed 
State-Changed-By: pfg 
State-Changed-When: Thu Dec 26 01:16:46 UTC 2013 
State-Changed-Why:  
Unfortunately this requires a lot more work (and testing). 

http://www.freebsd.org/cgi/query-pr.cgi?pr=184533 
>Unformatted:
