all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Mike Kazantsev <mk.fraggod@gmail.com>
To: emacs-devel@gnu.org
Cc: Julien Danjou <julien@danjou.info>, Michael Olson <mwolson@gnu.org>
Subject: [PATCH] etc-dcc: Fix handling SEND commands with unquoted filename.
Date: Wed, 9 May 2012 17:57:58 +0600	[thread overview]
Message-ID: <20120509175758.6a613706@sacrilege> (raw)

[-- Attachment #1: Type: text/plain, Size: 2920 bytes --]

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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

             reply	other threads:[~2012-05-09 11:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-09 11:57 Mike Kazantsev [this message]
2012-05-09 15:29 ` [PATCH] etc-dcc: Fix handling SEND commands with unquoted filename Michael Olson
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=20120509175758.6a613706@sacrilege \
    --to=mk.fraggod@gmail.com \
    --cc=emacs-devel@gnu.org \
    --cc=julien@danjou.info \
    --cc=mwolson@gnu.org \
    /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.