Explanation and patch make sense, +1 from me. On Wed, May 9, 2012 at 4:57 AM, Mike Kazantsev wrote: > 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: > > (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. > > > From 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 > adds 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)) > -- > 1.7.10 > > > -- > Mike Kazantsev // fraggod.net > -- Michael Olson | http://mwolson.org/