discussion and development of piem
 help / color / mirror / code / Atom feed
From: Kyle Meyer <kyle@kyleam.com>
To: piem@inbox.kyleam.com
Subject: [PATCH] inject: Anchor 'From mboxrd@z ...' search
Date: Tue, 19 Jan 2021 00:40:42 -0500
Message-ID: <20210119054042.11985-1-kyle@kyleam.com> (raw)

piem--write-mbox-to-maildir finds the bounds for each message by doing
a plain search for "From mboxrd@z", but of course nothing prevents
that from being within the text of the message.  Anchor it to the
start of the line to prevent false positives.

  This embarrassing gem was found when trying to inject

 piem.el | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/piem.el b/piem.el
index 8c23e7b..867a7e5 100644
--- a/piem.el
+++ b/piem.el
@@ -489,9 +489,9 @@ (defun piem--write-mbox-to-maildir ()
   (let ((n-added 0)
         (n-skipped 0))
     (while (and (not (eobp))
-                (search-forward "From mboxrd@z" nil t))
+                (re-search-forward "^From mboxrd@z" nil t))
       (let* ((beg (line-beginning-position 2))
-             (end (or (and (search-forward "From mboxrd@z" nil t)
+             (end (or (and (re-search-forward "^From mboxrd@z" nil t)
                            (progn (goto-char (line-beginning-position 0))

base-commit: 9abfc09d24e73044f2392f45fc41169ee4afd72f

                 reply	other threads:[~2021-01-19  5:41 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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:

  List information: https://git.kyleam.com/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210119054042.11985-1-kyle@kyleam.com \
    --to=kyle@kyleam.com \
    --cc=piem@inbox.kyleam.com \
    --subject='Re: [PATCH] inject: Anchor '\''From mboxrd@z ...'\'' search' \


* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

discussion and development of piem

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.kyleam.com/piem/0 piem/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 piem piem/ https://inbox.kyleam.com/piem \
	public-inbox-index piem

Example config snippet for mirrors.
Newsgroup available over NNTP:

code repositories for project(s) associated with this inbox:


AGPL code for this site: git clone http://ou63pmih66umazou.onion/public-inbox.git