From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MGarY-0007Sw-Rv for qemu-devel@nongnu.org; Tue, 16 Jun 2009 11:46:16 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MGarU-0007R8-2j for qemu-devel@nongnu.org; Tue, 16 Jun 2009 11:46:16 -0400 Received: from [199.232.76.173] (port=41284 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MGarT-0007R5-Ri for qemu-devel@nongnu.org; Tue, 16 Jun 2009 11:46:11 -0400 Received: from fmmailgate02.web.de ([217.72.192.227]:60828) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MGarT-0004sK-Hu for qemu-devel@nongnu.org; Tue, 16 Jun 2009 11:46:11 -0400 Message-ID: <4A37BE3D.7090603@web.de> Date: Tue, 16 Jun 2009 17:46:05 +0200 From: Jan Kiszka MIME-Version: 1.0 Subject: Re: [Qemu-devel] Re: monitor: check for readline in monitor_event() References: <20090615173858.31514f4f@doriath> <4A36CE52.6020100@web.de> <20090616094724.2724f916@doriath> In-Reply-To: <20090616094724.2724f916@doriath> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig784AD633317FF66D44D08D5F" Sender: jan.kiszka@web.de List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Luiz Capitulino Cc: qemu-devel This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig784AD633317FF66D44D08D5F Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Luiz Capitulino wrote: > On Tue, 16 Jun 2009 00:42:26 +0200 > Jan Kiszka wrote: >=20 >> Luiz Capitulino wrote: >>> The call of readline_show_prompt() in CHR_EVENT_RESET's body will >>> trig a segfault if readline is not being used, because 'mon->rs' >>> will be NULL. >>> >>> This fixes the problem by adding the proper check. >>> >>> I've trigged this while playing with an off-tree code that disables >>> readline support, I'm not sure whether in-tree code can trig this. >>> >>> Signed-off-by: Luiz Capitulino >>> --- >>> monitor.c | 2 +- >>> 1 files changed, 1 insertions(+), 1 deletions(-) >>> >>> diff --git a/monitor.c b/monitor.c >>> index 6b45f6c..787101d 100644 >>> --- a/monitor.c >>> +++ b/monitor.c >>> @@ -3002,7 +3002,7 @@ static void monitor_event(void *opaque, int >>> event) case CHR_EVENT_RESET: >>> monitor_printf(mon, "QEMU %s monitor - type 'help' for >>> more " "information\n", QEMU_VERSION); >>> - if (mon->chr->focus =3D=3D 0) >>> + if (mon->rs && mon->chr->focus =3D=3D 0) >>> readline_show_prompt(mon->rs); >>> break; >>> } >> In-tree code is not affected as no monitor user will call >> qemu_chr_reset for the associated char device if there is no readline >> active as well. Yeah, secret de-facto rule. >=20 > Ok. >=20 >> The patch is not incorrect, but I would like to understand the >> out-of-tree use case behind it. So you do want the info line printed, >> but provide your own readline processor? What kind of terminal is >> this? >=20 > I'm working on a machine-friendly monitor for QEMU, which disables > readline. Again, I bet that your monitor will not be interested in the prompt header. So I think we should rather exclude the whole CHR_EVENT_RESET path for the !mon->rs case. >=20 > I didn't want to get into the details now, it will be better to > discuss the prototype I'm writing, should be finished soon. Looking forward! Jan --------------enig784AD633317FF66D44D08D5F Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (GNU/Linux) Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org iEYEARECAAYFAko3vkAACgkQniDOoMHTA+mZagCeLDR84tqAOjXFxxIR/ehW7Vay pWwAn0OsM6i1lQmw768NTh+O11863rrx =IOTI -----END PGP SIGNATURE----- --------------enig784AD633317FF66D44D08D5F--