NetBSD Problem Report #56622

From www@netbsd.org  Thu Jan 13 19:07:21 2022
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 35EDD1A9239
	for <gnats-bugs@gnats.NetBSD.org>; Thu, 13 Jan 2022 19:07:21 +0000 (UTC)
Message-Id: <20220113190719.B490E1A923A@mollari.NetBSD.org>
Date: Thu, 13 Jan 2022 19:07:19 +0000 (UTC)
From: walter.lozano@collabora.com
Reply-To: walter.lozano@collabora.com
To: gnats-bugs@NetBSD.org
Subject: Improve libedit compatibility with readline related to rl_readline_state
X-Send-Pr-Version: www-1.0

>Number:         56622
>Category:       lib
>Synopsis:       Improve libedit compatibility with readline related to rl_readline_state
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    lib-bug-people
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Thu Jan 13 19:10:00 +0000 2022
>Last-Modified:  Mon Jan 31 22:45:01 +0000 2022
>Originator:     Walter Lozano
>Release:        
>Organization:
Collabora
>Environment:
>Description:
To add better compatibility some additional symbols should added related to rl_readline_state.
>How-To-Repeat:

>Fix:
I prepared the following patch. It only add support of RL_STATE_DONE, which is the most commonly used (at least in the utilities I use).

cvs diff: Diffing .
Index: readline.c
===================================================================
RCS file: /cvsroot/src/lib/libedit/readline.c,v
retrieving revision 1.169
diff -u -r1.169 readline.c
--- readline.c	11 Jan 2022 18:30:15 -0000	1.169
+++ readline.c	13 Jan 2022 19:02:28 -0000
@@ -128,7 +128,7 @@
 VFunction *rl_prep_term_function = (VFunction *)rl_prep_terminal;
 VFunction *rl_deprep_term_function = (VFunction *)rl_deprep_terminal;
 KEYMAP_ENTRY_ARRAY emacs_meta_keymap;
-unsigned long rl_readline_state;
+unsigned long rl_readline_state = RL_STATE_NONE;
 int _rl_complete_mark_directories;
 rl_icppfunc_t *rl_directory_completion_hook;
 int rl_completion_suppress_append;
@@ -311,6 +311,8 @@
 	if (h != NULL)
 		history_end(h);

+	RL_UNSETSTATE(RL_STATE_DONE);
+
 	if (!rl_instream)
 		rl_instream = stdin;
 	if (!rl_outstream)
@@ -2145,6 +2147,7 @@
 		if (done == 2) {
 			if ((wbuf = strdup(buf)) != NULL)
 				wbuf[count] = '\0';
+			RL_SETSTATE(RL_STATE_DONE);
 		} else
 			wbuf = NULL;
 		(*(void (*)(const char *))rl_linefunc)(wbuf);
cvs diff: Diffing TEST
cvs diff: Diffing readline
Index: readline/readline.h
===================================================================
RCS file: /cvsroot/src/lib/libedit/readline/readline.h,v
retrieving revision 1.48
diff -u -r1.48 readline.h
--- readline/readline.h	11 Jan 2022 18:30:15 -0000	1.48
+++ readline/readline.h	13 Jan 2022 19:02:28 -0000
@@ -94,6 +94,13 @@
 #define RL_PROMPT_START_IGNORE	'\1'
 #define RL_PROMPT_END_IGNORE	'\2'

+#define RL_STATE_NONE		0x000000
+#define RL_STATE_DONE		0x000001
+
+#define RL_SETSTATE(x)		(rl_readline_state |= ((unsigned long) x))
+#define RL_UNSETSTATE(x)	(rl_readline_state &= ~((unsigned long) x))
+#define RL_ISSTATE(x)		(rl_readline_state & ((unsigned long) x))
+
 /* global variables used by readline enabled applications */
 #ifdef __cplusplus
 extern "C" {

>Audit-Trail:
From: Walter Lozano <walter.lozano@collabora.com>
To: gnats-bugs@netbsd.org,
 "lib-bug-people@netbsd.org" <lib-bug-people@netbsd.org>
Cc: 
Subject: Re: lib/56622: Improve libedit compatibility with readline related to
 rl_readline_state
Date: Mon, 31 Jan 2022 10:15:04 -0300

 Hi all,

 On 1/13/22 16:10, gnats-admin@netbsd.org wrote:
 > Thank you very much for your problem report.
 > It has the internal identification `lib/56622'.
 > The individual assigned to look at your
 > report is: lib-bug-people.
 > 
 >> Category:       lib
 >> Responsible:    lib-bug-people
 >> Synopsis:       Improve libedit compatibility with readline related to rl_readline_state
 >> Arrival-Date:   Thu Jan 13 19:10:00 +0000 2022
 > 


 I would like to check the status of this patch, since I noticed that a 
 later patch I have sent was already merged. Maybe something is wrong but 
 I didn't received any notification.

 Thanks in advance,

 -- 
 Walter Lozano
 Collabora Ltd.

From: "Christos Zoulas" <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/56622 CVS commit: src/lib/libedit
Date: Mon, 31 Jan 2022 09:44:50 -0500

 Module Name:	src
 Committed By:	christos
 Date:		Mon Jan 31 14:44:49 UTC 2022

 Modified Files:
 	src/lib/libedit: readline.c
 	src/lib/libedit/readline: readline.h

 Log Message:
 PR/56622: Walter Lozano: Improve readline compatibility by adding
 rl_readline_state support.


 To generate a diff of this commit:
 cvs rdiff -u -r1.170 -r1.171 src/lib/libedit/readline.c
 cvs rdiff -u -r1.50 -r1.51 src/lib/libedit/readline/readline.h

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: Christos Zoulas <christos@zoulas.com>
To: gnats-bugs@netbsd.org
Cc: lib-bug-people@netbsd.org,
 gnats-admin@netbsd.org,
 netbsd-bugs@netbsd.org,
 walter.lozano@collabora.com
Subject: Re: lib/56622: Improve libedit compatibility with readline related to
 rl_readline_state
Date: Mon, 31 Jan 2022 09:45:10 -0500

 --Apple-Mail=_930147C9-A1FB-4B78-9180-C29D1BC3CE65
 Content-Transfer-Encoding: 7bit
 Content-Type: text/plain;
 	charset=us-ascii

 You are right, I missed it :-)

 christos

 --Apple-Mail=_930147C9-A1FB-4B78-9180-C29D1BC3CE65
 Content-Transfer-Encoding: 7bit
 Content-Disposition: attachment;
 	filename=signature.asc
 Content-Type: application/pgp-signature;
 	name=signature.asc
 Content-Description: Message signed with OpenPGP

 -----BEGIN PGP SIGNATURE-----
 Comment: GPGTools - http://gpgtools.org

 iF0EARECAB0WIQS+BJlbqPkO0MDBdsRxESqxbLM7OgUCYff19gAKCRBxESqxbLM7
 OqGhAKCFpbxQclHa2B3gevI2ZV9HUa+T7wCeJFkAMk35jJoPg54WfarLCn3bVPU=
 =w1z+
 -----END PGP SIGNATURE-----

 --Apple-Mail=_930147C9-A1FB-4B78-9180-C29D1BC3CE65--

From: Walter Lozano <walter.lozano@collabora.com>
To: Christos Zoulas <christos@zoulas.com>, gnats-bugs@netbsd.org
Cc: lib-bug-people@netbsd.org, gnats-admin@netbsd.org, netbsd-bugs@netbsd.org
Subject: Re: lib/56622: Improve libedit compatibility with readline related to
 rl_readline_state
Date: Mon, 31 Jan 2022 11:48:49 -0300

 Hi all,

 On 1/31/22 11:45, Christos Zoulas wrote:
 > You are right, I missed it :-)
 > 

 Thank you for your prompt response!

 Regards,

 -- 
 Walter Lozano
 Collabora Ltd.

From: Walter Lozano <walter.lozano@collabora.com>
To: Christos Zoulas <christos@zoulas.com>, gnats-bugs@netbsd.org
Cc: lib-bug-people@netbsd.org, gnats-admin@netbsd.org, netbsd-bugs@netbsd.org
Subject: Re: lib/56622: Improve libedit compatibility with readline related to
 rl_readline_state
Date: Mon, 31 Jan 2022 11:46:35 -0300

 Hi Christos,

 On 1/31/22 11:45, Christos Zoulas wrote:
 > You are right, I missed it :-)
 > 

 Thank you for your prompt response!
 > christos

 -- 
 Walter Lozano
 Collabora Ltd.

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.46 2020/01/03 16:35:01 leot Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2020 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.