From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: "J.P." Newsgroups: gmane.emacs.bugs Subject: bug#50008: [J.P.] Re: bug#50008: 28.0.50; ERC sends empty lines with user input Date: Tue, 22 Mar 2022 01:50:41 -0700 Message-ID: <87lex2l6am.fsf@neverwas.me> References: <877dgsjcez.fsf@neverwas.me> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="29584"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) To: 50008@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Mar 22 09:52:16 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nWaFT-0007V0-0B for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 22 Mar 2022 09:52:15 +0100 Original-Received: from localhost ([::1]:37222 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nWaFR-0000nZ-JA for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 22 Mar 2022 04:52:13 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:37304) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nWaFG-0000nN-Vf for bug-gnu-emacs@gnu.org; Tue, 22 Mar 2022 04:52:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:45262) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nWaFG-0007Uc-Lr for bug-gnu-emacs@gnu.org; Tue, 22 Mar 2022 04:52:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nWaFG-00046q-Gt for bug-gnu-emacs@gnu.org; Tue, 22 Mar 2022 04:52:02 -0400 X-Loop: help-debbugs@gnu.org In-Reply-To: <877dgsjcez.fsf@neverwas.me> Resent-From: "J.P." Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 22 Mar 2022 08:52:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 50008 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 50008-submit@debbugs.gnu.org id=B50008.164793907215738 (code B ref 50008); Tue, 22 Mar 2022 08:52:02 +0000 Original-Received: (at 50008) by debbugs.gnu.org; 22 Mar 2022 08:51:12 +0000 Original-Received: from localhost ([127.0.0.1]:39159 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nWaER-00045l-2V for submit@debbugs.gnu.org; Tue, 22 Mar 2022 04:51:12 -0400 Original-Received: from mail-108-mta150.mxroute.com ([136.175.108.150]:36081) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nWaEB-00044v-25 for 50008@debbugs.gnu.org; Tue, 22 Mar 2022 04:51:09 -0400 Original-Received: from filter006.mxroute.com ([140.82.40.27] 140.82.40.27.vultrusercontent.com) (Authenticated sender: mN4UYu2MZsgR) by mail-108-mta150.mxroute.com (ZoneMTA) with ESMTPSA id 17fb0d24458000fe85.001 for <50008@debbugs.gnu.org> (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES128-GCM-SHA256); Tue, 22 Mar 2022 08:50:44 +0000 X-Zone-Loop: 421482221445394bd52c3bab0032b23975c5be9abea5 X-Originating-IP: [140.82.40.27] DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=neverwas.me ; s=x; h=Content-Type:MIME-Version:Message-ID:Date:Subject:To:From:Sender: Reply-To:Cc:Content-Transfer-Encoding:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=TEdXIos/sB+D2HdV6wkOI+seT+CmFzx57G/CXElzHTk=; b=KyeQqp0ylUfJdqzGx26zuuACdu ajtePnhZ7qKDJGjm5mKsIpXkQ1Ux4id6/xA72haJiw4Ogx6hBNWiTDoktgb4J4knHpq52vA3/Re7G NKdXTdyP1jNhuQeFA6rgvrDO08VkdonztRSTn9KSFgPBt/ssu1Eno7+j4Z0HOfasSAVz+DaMYOhNL y68GydPJeDdlYXWRsRUvkASNF9lPccCMGj1D6OKaThJVrmCulsZ0ffUHy2Y8Q2m9BpnSZgu3b+a0y 77HjGpWsC6F1x/n4Dwpaq8Coq1Uid7nT0n1pcNTPfxAw4et0gnUF95ZtlZ2cbo5XiHYH1OyCURWdW t7qe+f0w==; X-AuthUser: masked@neverwas.me X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:228739 Archived-At: --=-=-= Content-Type: text/plain Prior attempt was blocked (archived). -------------------- Start of forwarded message -------------------- From: "J.P." To: Lars Ingebrigtsen Cc: 50008@debbugs.gnu.org, bandali@gnu.org, emacs-erc@gnu.org Subject: Re: bug#50008: 28.0.50; ERC sends empty lines with user input Date: Tue, 22 Mar 2022 01:37:20 -0700 --=-=-= Content-Type: multipart/mixed; boundary="==-=-=" --==-=-= Content-Type: text/plain Content-Disposition: inline Lars Ingebrigtsen writes: > "J.P." writes: > >> Subject: [PATCH] Don't send empty lines for implicit targets in ERC > > Makes sense to me, and testing it a bit doesn't seem to show any > regressions, so I've now pushed this to Emacs 29. I just noticed a regression that remained hidden all this while because I failed to call the function realistically in its unit test. Luckily, this only affects master. I've attached a fix here just to have something for the record. But I figure there's little harm in deferring and tossing it in with some other stuff I'm preparing (in a new bug report) to try and simplify the input processing situation. Thanks. --==-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Fix-regression-in-erc-send-input-line.patch > From dc7005fe509f573e86aef0a87ec8b650a1aacec4 Mon Sep 17 00:00:00 2001 From: "F. Jason Park" Date: Mon, 21 Mar 2022 19:21:57 -0700 Subject: [PATCH] Fix regression in erc-send-input-line * lisp/erc/erc.el (erc-send-input-line): Restore remedial single-space padding to ensure empty messages typed at the prompt without an explicit /msg aren't rejected by the server. This behavior is only noticeable when `erc-send-whitespace-lines' is active. * test/lisp/erc/erc-tests.el (erc-process-input-line): Add trailing newline to more correctly simulate how it's actually called by `erc-send-input'. (Bug#50008) --- lisp/erc/erc.el | 2 ++ test/lisp/erc/erc-tests.el | 10 +++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el index 52fe106f2d..d8ef62cf93 100644 --- a/lisp/erc/erc.el +++ b/lisp/erc/erc.el @@ -2817,6 +2817,8 @@ erc-send-input-line-function (defun erc-send-input-line (target line &optional force) "Send LINE to TARGET." + (when (string= line "\n") + (setq line " \n")) (erc-message "PRIVMSG" (concat target " " line) force)) (defun erc-get-arglist (fun) diff --git a/test/lisp/erc/erc-tests.el b/test/lisp/erc/erc-tests.el index 520f10dd4e..10e3c16dfc 100644 --- a/test/lisp/erc/erc-tests.el +++ b/test/lisp/erc/erc-tests.el @@ -340,19 +340,19 @@ erc-process-input-line (ert-info ("Implicit cmd via `erc-send-input-line-function'") (ert-info ("Baseline") - (erc-process-input-line "hi") + (erc-process-input-line "hi\n") (should (equal (pop erc-server-flood-queue) '("PRIVMSG #chan :hi\r\n" . utf-8)))) (ert-info ("Spaces preserved") - (erc-process-input-line "hi you") + (erc-process-input-line "hi you\n") (should (equal (pop erc-server-flood-queue) '("PRIVMSG #chan :hi you\r\n" . utf-8)))) - (ert-info ("Empty line transmitted without injected-space kludge") - (erc-process-input-line "") + (ert-info ("Empty line transmitted with injected-space kludge") + (erc-process-input-line "\n") (should (equal (pop erc-server-flood-queue) - '("PRIVMSG #chan :\r\n" . utf-8)))) + '("PRIVMSG #chan : \r\n" . utf-8)))) (should-not calls)))))) -- 2.35.1 --==-=-=-- --=-=-= Content-Type: text/plain -------------------- End of forwarded message -------------------- --=-=-=--