From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Victor Orlikowski Newsgroups: gmane.emacs.devel Subject: [PATCH] Fixes to allow erc-dcc-get-filter to work properly Date: Sun, 3 Feb 2019 17:47:16 +0000 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="83211"; mail-complaints-to="usenet@blaine.gmane.org" To: "emacs-devel@gnu.org" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Feb 03 19:06:54 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gqMAQ-000LWb-Fi for ged-emacs-devel@m.gmane.org; Sun, 03 Feb 2019 19:06:54 +0100 Original-Received: from localhost ([127.0.0.1]:58855 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gqMAP-0006eI-H2 for ged-emacs-devel@m.gmane.org; Sun, 03 Feb 2019 13:06:53 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:52345) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gqM6X-0003z9-6U for emacs-devel@gnu.org; Sun, 03 Feb 2019 13:02:55 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gqLrZ-0005Wr-Tk for emacs-devel@gnu.org; Sun, 03 Feb 2019 12:47:28 -0500 Original-Received: from smtp-gw-16.oit.duke.edu ([152.3.189.242]:53078 helo=mail-gw-16.oit.duke.edu) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gqLrV-0005Fc-Hi for emacs-devel@gnu.org; Sun, 03 Feb 2019 12:47:23 -0500 Authentication-Results: mail-gw.oit.duke.edu; spf=none smtp.mailfrom=vjo@duke.edu; dmarc=none Original-Received: from NAM04-CO1-obe.outbound.protection.outlook.com (mail-co1nam04lp2051.outbound.protection.outlook.com [104.47.45.51]) by mail-gw-16.oit.duke.edu (8.16.0.27/8.16.0.27) with ESMTPS id x13HlHCu009544 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Sun, 3 Feb 2019 12:47:18 -0500 Original-Received: from CO2PR05MB2488.namprd05.prod.outlook.com (10.166.95.146) by CO2PR05MB732.namprd05.prod.outlook.com (10.141.228.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1601.11; Sun, 3 Feb 2019 17:47:16 +0000 Original-Received: from CO2PR05MB2488.namprd05.prod.outlook.com ([fe80::b10c:f1aa:5c08:17f7]) by CO2PR05MB2488.namprd05.prod.outlook.com ([fe80::b10c:f1aa:5c08:17f7%2]) with mapi id 15.20.1601.013; Sun, 3 Feb 2019 17:47:16 +0000 Thread-Topic: [PATCH] Fixes to allow erc-dcc-get-filter to work properly Thread-Index: AQHUu+iAz1YjTNoSkkK0QXoy4+2WEA== Accept-Language: en-US Content-Language: en-US x-originating-ip: [50.111.87.13] x-clientproxiedby: BN6PR12CA0037.namprd12.prod.outlook.com (2603:10b6:405:70::23) To CO2PR05MB2488.namprd05.prod.outlook.com (2603:10b6:102:10::18) x-ms-exchange-messagesentrepresentingtype: 1 x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; CO2PR05MB732; 20:qhaTvMx/LWC5r8j4bJNMuzISmWFQ4Ky8SqRPnU8Ts4H0DN/OXNY52rJLeF2l1IRJarnTvpjSVdp3UQPl6TyR06fg10Jbtq6y9Yk0DBEVIBGeXV1xndSEsYkPFF61Vp41Ri4KYkc4AePo8I0rQUGeR8WssIsgZYXkGGCMZ4bM4oI= x-ms-office365-filtering-correlation-id: 430c053a-1661-4d0e-7fce-08d689ffa2d0 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600110)(711020)(4605077)(2017052603328)(7153060)(7193020); SRVR:CO2PR05MB732; x-ms-traffictypediagnostic: CO2PR05MB732: x-microsoft-antispam-prvs: x-forefront-prvs: 0937FB07C5 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(7916004)(376002)(39860400002)(346002)(136003)(366004)(396003)(199004)(189003)(2906002)(33716001)(81156014)(786003)(486006)(316002)(476003)(81166006)(305945005)(6916009)(8936002)(102836004)(68736007)(88552002)(26005)(53936002)(66066001)(186003)(6512007)(9686003)(97736004)(256004)(5024004)(14444005)(8676002)(6486002)(2501003)(99286004)(7736002)(3846002)(6116002)(75432002)(71190400001)(33896004)(14454004)(5640700003)(86362001)(71200400001)(52116002)(386003)(6436002)(53546011)(105586002)(25786009)(2351001)(478600001)(106356001)(6506007); DIR:OUT; SFP:1102; SCL:1; SRVR:CO2PR05MB732; H:CO2PR05MB2488.namprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: duke.edu does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: JAO0/lpvVw7ezxwoBpJMWxw9euk9aTH5L8gdvOaUKzxJ6cAuPYGEjomKBoiXPRN4jnJVntyUb/cIdY3liAkQUUPDuzwM7hvM/1MBnI13lYF1WXvvD79l/KL1wMOT0cP9MZxa7DeaX2mFVPePhf1D94LBibCCqRuirqcgpnQNGZ5W055wnToEeNVcRS1G71RDlGErWyyen87zc77GyF/yAf7oQcHUC8SYP7r+Rhn2gqFuWLNigQGlyV6JZx/klf25ZkCm0s0W/El8FULJz2rRaDdnmAHgsVWngqBkx7FJO5yzJK4pSP8UBay6eW5KryQr5VafNJGiw/9EfDvsxD7+qUQPKyl9wV/EPQumaJso9yXQyJuLXlhRA36SGN5XyNuIPyTYyMLpkwpSL8XmBpB8vn0UbgnKB0UlLoitID5Oenk= X-OriginatorOrg: duke.edu X-MS-Exchange-CrossTenant-Network-Message-Id: 430c053a-1661-4d0e-7fce-08d689ffa2d0 X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Feb 2019 17:47:15.8661 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-id: cb72c54e-4a31-4d9e-b14a-1ea36dfac94c X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO2PR05MB732 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-02-03_08:, , signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1902030147 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-Received-From: 152.3.189.242 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:232939 Archived-At: When using erc-dcc-get-filter with erc-dcc-verbose set to t, message errors prevent the DCC get from completing correctly. The attached patch adds some additional error checking to erc-dcc-get-filter, and uses erc-dcc-file-name in place of buffer-file-name (which ends up being nil in this context, and causing the message errors). >From 22bbaa226ad0550f566b4d2978e0aea4c72f82a1 Mon Sep 17 00:00:00 2001 From: "Victor J. Orlikowski" Date: Sun, 3 Feb 2019 12:36:26 -0500 Subject: [PATCH] Perform additional validation in erc-dcc-get-filter, and u= se erc-dcc-file-name rather than buffer-file-name (which is actually nil in t= his context). --- lisp/erc/erc-dcc.el | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lisp/erc/erc-dcc.el b/lisp/erc/erc-dcc.el index 8a40b1454b..842a3b2b19 100644 --- a/lisp/erc/erc-dcc.el +++ b/lisp/erc/erc-dcc.el @@ -979,17 +979,20 @@ rather than every 1024 byte block, but nobody seems t= o care." (let ((inhibit-read-only t) received-bytes) (goto-char (point-max)) - (insert (string-make-unibyte str)) + (if str + (insert (string-make-unibyte str))) =20 (when (> (point-max) erc-dcc-receive-cache) (erc-dcc-append-contents (current-buffer) erc-dcc-file-name)) - (setq received-bytes (+ (buffer-size) erc-dcc-byte-count)) + (setq received-bytes (buffer-size)) + (if erc-dcc-byte-count + (setq received-bytes (+ received-bytes erc-dcc-byte-count))) =20 (and erc-dcc-verbose (erc-display-message nil 'notice erc-server-process 'dcc-get-bytes-received - ?f (file-name-nondirectory buffer-file-name) + ?f (file-name-nondirectory erc-dcc-file-name) ?b (number-to-string received-bytes))) (cond ((and (> (plist-get erc-dcc-entry-data :size) 0) @@ -997,7 +1000,7 @@ rather than every 1024 byte block, but nobody seems to= care." (erc-display-message nil '(notice error) 'active 'dcc-get-file-too-long - ?f (file-name-nondirectory buffer-file-name)) + ?f (file-name-nondirectory erc-dcc-file-name)) (delete-process proc)) (t (process-send-string --=20 2.20.0 Best, Victor --=20 Victor J. Orlikowski <> vjo@(ee.|cs.)?duke.edu