From: Michael Olson <mwolson@gnu.org>
To: Mike Kazantsev <mk.fraggod@gmail.com>
Cc: Julien Danjou <julien@danjou.info>, emacs-devel@gnu.org
Subject: Re: [PATCH] etc-dcc: Fix handling SEND commands with unquoted filename.
Date: Wed, 9 May 2012 08:29:30 -0700 [thread overview]
Message-ID: <CAN4ruPhH2OBXrFNwADUeUtd9kT+g8Xa35zVwXUGr0Wb00crXgA@mail.gmail.com> (raw)
In-Reply-To: <20120509175758.6a613706@sacrilege>
[-- Attachment #1: Type: text/plain, Size: 3138 bytes --]
Explanation and patch make sense, +1 from me.
On Wed, May 9, 2012 at 4:57 AM, Mike Kazantsev <mk.fraggod@gmail.com> 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 <mk.fraggod@gmail.com>
> 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/
[-- Attachment #2: Type: text/html, Size: 4111 bytes --]
next prev parent reply other threads:[~2012-05-09 15:29 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-09 11:57 [PATCH] etc-dcc: Fix handling SEND commands with unquoted filename Mike Kazantsev
2012-05-09 15:29 ` Michael Olson [this message]
2012-05-14 15:43 ` Julien Danjou
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAN4ruPhH2OBXrFNwADUeUtd9kT+g8Xa35zVwXUGr0Wb00crXgA@mail.gmail.com \
--to=mwolson@gnu.org \
--cc=emacs-devel@gnu.org \
--cc=julien@danjou.info \
--cc=mk.fraggod@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.