From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Mike Kazantsev Newsgroups: gmane.emacs.devel Subject: [PATCH] etc-dcc: Fix handling SEND commands with unquoted filename. Date: Wed, 9 May 2012 17:57:58 +0600 Message-ID: <20120509175758.6a613706@sacrilege> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/signed; micalg=PGP-SHA1; boundary="Sig_/tzucFnNKxyzM5U3XL2Pxfez"; protocol="application/pgp-signature" X-Trace: dough.gmane.org 1336564705 18311 80.91.229.3 (9 May 2012 11:58:25 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 9 May 2012 11:58:25 +0000 (UTC) Cc: Julien Danjou , Michael Olson To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed May 09 13:58:20 2012 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1SS5X8-00039E-H1 for ged-emacs-devel@m.gmane.org; Wed, 09 May 2012 13:58:18 +0200 Original-Received: from localhost ([::1]:57130 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SS5X8-0005Ns-0M for ged-emacs-devel@m.gmane.org; Wed, 09 May 2012 07:58:18 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:40306) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SS5X4-0005Nm-Ul for emacs-devel@gnu.org; Wed, 09 May 2012 07:58:16 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SS5X2-0007jx-Cc for emacs-devel@gnu.org; Wed, 09 May 2012 07:58:14 -0400 Original-Received: from mail-lb0-f169.google.com ([209.85.217.169]:40591) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SS5X2-0007jQ-29; Wed, 09 May 2012 07:58:12 -0400 Original-Received: by lbjn8 with SMTP id n8so170016lbj.0 for ; Wed, 09 May 2012 04:58:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:x-mailer:mime-version :content-type; bh=RwVWkyW0J6jbDbQMtFeK2YO0NGBMyhprqlVqc6PMpoo=; b=mbDHgt9lMERhtFZgxtMkCfiBh/Qg9K+RwhddcSxVhDskojBAEln+0r3ZntL0P+5K50 7r2HjnPcCS1VxokFsxHSqsPOtNZ27mtW34P7ZMRNkr4lRN08lrt6fKB7HKM585aYyYiV ZZL1WIt9yY8Y9ldLF5TmQF9N07yLphIoY7xhsTnXo4GfZq+vTbrDf9mKhMrtzZOQGKy3 72sIOWxz/JnglZlpYFrtAdrBTSIfMax5euxCfNjbQ4LXdWgqFWkIUjxespM7GStVmfR3 d7P8AH8rGU2tu/yGQe2dohMMwibso7BVJYmiRc3/JSpEFF6/OPC/lZtBbj0Bw/qAS3XW Gmrw== Original-Received: by 10.112.29.233 with SMTP id n9mr10172715lbh.91.1336564687359; Wed, 09 May 2012 04:58:07 -0700 (PDT) Original-Received: from sacrilege ([188.226.51.71]) by mx.google.com with ESMTPS id k3sm3110005lbz.4.2012.05.09.04.58.04 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 09 May 2012 04:58:05 -0700 (PDT) X-Mailer: Claws Mail 3.8.0 (GTK+ 2.24.10; i686-pc-linux-gnu) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.217.169 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 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-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:150387 Archived-At: --Sig_/tzucFnNKxyzM5U3XL2Pxfez Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Good day, Patch is a fix for a regression, which was introduced by the patch I previously posted on this list (Date: Mon, 31 Oct 2011 09:56:58 +0600, Subject: [PATCH] erc-dcc: allow SEND commands containing quoted filenames with spaces in them). As I see, it was picked up by Julien on Mon Nov 28 10:24:08 2011 +0100 in bb90806bc156833c (git://git.savannah.gnu.org/emacs.git). Unfortunately, during one of the iterations of regexp-mangling, I forgot to update match group number for *unquoted* filename matches, thus introducing the regression. Regexp in question is erc-dcc-ctcp-query-send-regexp and currently it looks like this: (concat "^DCC SEND \\(" ;; Following part matches either filename without spaces ;; or filename enclosed in double quotes with any number ;; of escaped double quotes inside. "\"\\(\\(.*?\\(\\\\\"\\)?\\)+?\\)\"\\|\\([^ ]+\\)" "\\) \\([0-9]+\\) \\([0-9]+\\) *\\([0-9]*\\)") And the match is dissected like this: =20 (let ((filename (or (match-string 3 query) (erc-dcc-unquote-filename (match-string 2 query)))) (ip (erc-decimal-to-ip (match-string 6 query))) ... As can be seen, though, unquoted filename is only matched by the fifth regexp group ("|\\([^ ]+\\)" part), not third, thus matching of unquoted filenames fails with non-descriptive nil-instead-of-string error. Issue was masked until now for me by custom (simplier hack) erc-dcc-ctcp-query-send-regexp definition in my config, older emacs version and relatively infrequent use of dcc with clients that don't use filename-quoting. Apologies to Julien and Michael for unasked-for CC, but I thought you might be interested and should be notified, as people who reviewed the initial patch. Sorry for a lousy job of testing previous patch. Thanks. =46rom e5fe5e71b0c7a898132dfce2a7ec72b8703079bd Mon Sep 17 00:00:00 2001 From: Mike Kazantsev Date: Wed, 9 May 2012 17:27:27 +0600 Subject: [PATCH] etc-dcc: Fix handling SEND commands with unquoted filename. * erc-dcc.el (erc-dcc-handle-ctcp-send): Fix regexp match group numbers. --- lisp/erc/erc-dcc.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/erc/erc-dcc.el b/lisp/erc/erc-dcc.el index ba87cf6..d1ef1a9 100644 --- a/lisp/erc/erc-dcc.el +++ b/lisp/erc/erc-dcc.el @@ -674,7 +674,7 @@ It extracts the information about the dcc request and a= dds it to ?r "SEND" ?n nick ?u login ?h host)) ((string-match erc-dcc-ctcp-query-send-regexp query) (let ((filename - (or (match-string 3 query) + (or (match-string 5 query) (erc-dcc-unquote-filename (match-string 2 query)))) (ip (erc-decimal-to-ip (match-string 6 query))) (port (match-string 7 query)) --=20 1.7.10 --=20 Mike Kazantsev // fraggod.net --Sig_/tzucFnNKxyzM5U3XL2Pxfez Content-Type: application/pgp-signature; name=signature.asc Content-Disposition: attachment; filename=signature.asc -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (GNU/Linux) iEYEARECAAYFAk+qW8kACgkQASbOZpzyXnEEQQCg7RmFm8EzKIrduJSB4tIQCJ8O fBgAoKbsMOiedNWhqN3jjFTEtnyDHiXW =iFLf -----END PGP SIGNATURE----- --Sig_/tzucFnNKxyzM5U3XL2Pxfez--