From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.polymtl.ca (smtp.polymtl.ca [132.207.4.11]) by sourceware.org (Postfix) with ESMTPS id 1F1D33853D7F for ; Fri, 16 Dec 2022 02:49:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 1F1D33853D7F Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=polymtl.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=polymtl.ca Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id 2BG2n5bg026720 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 15 Dec 2022 21:49:09 -0500 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 2BG2n5bg026720 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=polymtl.ca; s=default; t=1671158950; bh=DlZN3r5reC+Q3caPl+Ic7GNgx03ExgGRzygk/Zidn68=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=dMu9Uk7wO96UNva0v9fQozgSqsIfUhhjKTGVRIR14d1IQXS9QZrsxZKOCQ7awZH/R Xr7ZiitpEM3iYmnnR1pFPS7PD/wYsuFxtOVh0SFz8MiSDZ/Tb9tKPLhU62n52tYRDK YXwJ7F5ml10gnxgrEhWsAB/xp3WqXPMltNM9Ie2M= Received: from [10.0.0.11] (unknown [217.28.27.60]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id C8B0A1E0CD; Thu, 15 Dec 2022 21:49:04 -0500 (EST) Message-ID: <0d76f05d-101d-584e-99bd-8d232fcee229@polymtl.ca> Date: Thu, 15 Dec 2022 21:49:04 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.5.1 Subject: Re: [PATCH RESEND] gdb: remove static buffer in command_line_input Content-Language: en-US To: Tom Tromey , Simon Marchi via Gdb-patches Cc: Jan Vrany References: <20221215190625.758546-1-simon.marchi@polymtl.ca> <874jtwcpf0.fsf@tromey.com> From: Simon Marchi In-Reply-To: <874jtwcpf0.fsf@tromey.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Fri, 16 Dec 2022 02:49:05 +0000 X-Spam-Status: No, score=-3032.1 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 12/15/22 16:44, Tom Tromey wrote: >>>>>> "Simon" == Simon Marchi via Gdb-patches writes: > > Simon> [I sent this earlier today, but I don't see it in the archives. > Simon> Resending it through a different computer / SMTP.] > > I didn't see it either. > > Simon> Fix that by removing the static buffer. > > Wow, I've wanted to remove 'struct buffer' for a while now, this is a > big step toward that. Ah yeah, that's a nice side-effect indeed. > > Simon> So, it started with modifying command_line_input as described above, all > Simon> the other changes derive directly from that. > > It's hard to review / understand a change like this but it seems ok to > me, as far as I can tell. I was eager to make more simplifications / C++ifications, but some of them subtly broke things. So I opted to keep things the same as much as possible, really just change the type used to the buffer (use std::string) and change where it was stored. After spending a few hours debugging regressions, I am fairly confident that I understand the code flow and that the change is correct. I'll go ahead and push it, to unblock Jan's patch. > > Simon> One slightly shady thing is in handle_line_of_input, where we now pass a > Simon> pointer to an std::string's internal buffer to readline's history_value > Simon> function, which takes a `char *`. I'm pretty sure that this function > Simon> does not modify the input string, because I was able to change it (with > Simon> enough massaging) to take a `const char *`. > > I think sending a note to upstream readline would be good. I forgot to mention, but I did send this message: https://lists.gnu.org/archive/html/bug-readline/2022-12/msg00002.html Simon