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] v2: Fixes to allow erc-dcc-get-filter to work properly Date: Sun, 10 Feb 2019 19:14:26 +0000 Message-ID: <3FCFBDED-9040-41B1-9686-30773CA6EC08.notmuch@neverland> References: 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="138721"; 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 10 20:15:31 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 1gsuZe-000Ztk-GE for ged-emacs-devel@m.gmane.org; Sun, 10 Feb 2019 20:15:30 +0100 Original-Received: from localhost ([127.0.0.1]:34490 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gsuZd-00033p-7P for ged-emacs-devel@m.gmane.org; Sun, 10 Feb 2019 14:15:29 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:33693) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gsuYt-00031b-DI for emacs-devel@gnu.org; Sun, 10 Feb 2019 14:14:44 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gsuYr-00036D-JG for emacs-devel@gnu.org; Sun, 10 Feb 2019 14:14:43 -0500 Original-Received: from smtp-gw-14.oit.duke.edu ([152.3.189.240]:33980 helo=mail-gw-14.oit.duke.edu) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gsuYr-0002wU-2s for emacs-devel@gnu.org; Sun, 10 Feb 2019 14:14:41 -0500 Original-Received: from smtpgw-07.oit.duke.edu (smtpgw-07.oit.duke.edu [10.136.241.99]) by mail-gw-14.oit.duke.edu (8.16.0.27/8.16.0.27) with ESMTPS id x1AJESGJ016232 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Sun, 10 Feb 2019 14:14:28 -0500 Original-Received: from NAM03-BY2-obe.outbound.protection.outlook.com (mail-by2nam03lp2059.outbound.protection.outlook.com [104.47.42.59]) by smtpgw-07.oit.duke.edu (8.16.0.27/8.16.0.27) with ESMTPS id x1AJERec003203 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Sun, 10 Feb 2019 14:14:28 -0500 Original-Received: from CO2PR05MB2488.namprd05.prod.outlook.com (10.166.95.146) by CO2PR05MB2694.namprd05.prod.outlook.com (10.166.200.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1622.13; Sun, 10 Feb 2019 19:14:27 +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.1622.013; Sun, 10 Feb 2019 19:14:27 +0000 Thread-Topic: [PATCH] v2: Fixes to allow erc-dcc-get-filter to work properly Thread-Index: AQHUwXTX35b9f6xJ206gmTnxBDkCfg== Accept-Language: en-US Content-Language: en-US x-originating-ip: [50.111.87.13] x-clientproxiedby: BN7PR05CA0032.namprd05.prod.outlook.com (2603:10b6:406:ee::45) 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; CO2PR05MB2694; 20:Rx4dBTEky6isQsUbMOSqLeKwgdQd53s/Ueb+TbADKOX07NKAb1aCSBKqxjzyZa3/O9Egej8iloryJWqAqAl0dDpIzyzP2Y91FtzlgVx/kilUd/mBObUHJ7/GdyK1wWGs5UTYJLDjQe3wyROumLHOs6jcBBr3diLKj4j4hetRWQw= x-ms-office365-filtering-correlation-id: 71171b91-566a-4d80-d410-08d68f8bf959 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600110)(711020)(4605077)(2017052603328)(7153060)(7193020); SRVR:CO2PR05MB2694; x-ms-traffictypediagnostic: CO2PR05MB2694: x-microsoft-antispam-prvs: x-forefront-prvs: 09443CAA7E x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(7916004)(366004)(39860400002)(376002)(346002)(136003)(396003)(189003)(199004)(14454004)(2501003)(446003)(52116002)(68736007)(786003)(3846002)(6116002)(8936002)(6512007)(86362001)(478600001)(256004)(14444005)(5024004)(75432002)(316002)(6916009)(71190400001)(7736002)(71200400001)(5640700003)(26005)(25786009)(66066001)(6436002)(99286004)(9686003)(305945005)(476003)(2351001)(33896004)(53546011)(486006)(53936002)(186003)(6506007)(386003)(102836004)(105586002)(2906002)(97736004)(81166006)(81156014)(88552002)(6486002)(8676002)(76176011)(106356001)(33716001); DIR:OUT; SFP:1102; SCL:1; SRVR:CO2PR05MB2694; H:CO2PR05MB2488.namprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A: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: mq3FabHkNa1Vq+R3bIkSP415mH1dMFMqcCv6cAcRkuAH0NeAoSwQ49jFL1YqeDAlqRSGnWmPdiqXlc9h2tVQEOWj1DTyky0Ijsqx9eeWZl4BGxJU3kIhKcX0ZHgZdBL2daWIHMzudt4tw8jzxUZ2jQHBZYokwCT05P/L3Sdy7z9CPbMo3fdUFQ8GF2jV1fjI2DTHlIC0XvBaF1BXhOz10hGl1GwvbV+0Io9UD+vuKokRfYEghmmaSsQvMLeLl3M3/1AYnuZv/9GGUMgLXvAJFl9iBG1jqTsvRXHr3/c4H8xclR05Nahb6USt+PlhOBuC7c7KHMq6Y+VvHT/A13bKQNTqc5LDyvsicGDQv5zXJE23IUUsF4gd83dDNmU2BZkHv9ZhTeEdNHz1bdMQslkfhlU4zZM/8PrhAeBdbq6QK9Y= X-OriginatorOrg: duke.edu X-MS-Exchange-CrossTenant-Network-Message-Id: 71171b91-566a-4d80-d410-08d68f8bf959 X-MS-Exchange-CrossTenant-originalarrivaltime: 10 Feb 2019 19:14:26.3351 (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: CO2PR05MB2694 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-02-10_16:, , signatures=0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-02-10_16:, , signatures=0 X-Proofpoint-Spam-Reason: safe X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-Received-From: 152.3.189.240 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:233201 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 ethe function buffer-name in place of the variable buffer-file-name (which appears to be nil in this context, which thereby causes the message errors). >From cd390337b8e819248568b900e6115dde8a19fde9 Mon Sep 17 00:00:00 2001 From: "Victor J. Orlikowski" Date: Sun, 10 Feb 2019 11:13:57 -0500 Subject: [PATCH] Perform additional validation in erc-dcc-get-filter, and u= se the function buffer-name rather than buffer-file-name (which is actually n= il in this 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..2849e25bf7 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 (buffer-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 (buffer-name))) (delete-process proc)) (t (process-send-string --=20 2.20.0 Thanks, Victor --=20 Victor J. Orlikowski <> vjo@(ee.|cs.)?duke.edu