From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:aacc::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms12 with LMTPS id gCHjFu1wBmCFCgAAsNZ9tg (envelope-from ); Tue, 19 Jan 2021 05:41:01 +0000 Received: from out2.migadu.com ([2001:41d0:2:aacc::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id MLqeA+xwBmAdGwAAB5/wlQ (envelope-from ); Tue, 19 Jan 2021 05:41:00 +0000 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kyleam.com; s=key1; t=1611034859; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=z5jElM0Wovf+8HP4nSV+J42wh4jGA+B2ol6aIzaSS5w=; b=hkAjMSQwiX2LYMya77ZpCejXKRKWq5pkdjzBoLoU5LkIz0e9H7GhJsIpszSZp8a++dfG0S P/l+39D4LH/XPg4IqBgRyEnOSFg6z8bjm5r6a9ml+89iJqmbxKYzeVgV5ANs6PKhg3O7zM sMR+DOlndT3h05CLHLaSU3DwPib0vAXPxLCmp8vO8oT9gMCJ/kKvsBNtAT0vs6GtW9mHUB VRoj7w9rBaN72EmURizNuN9AwRsC1U6ji/Zy8KuUTQt+4OX0wFaJd7GPT5CnGvH4uvX4GI RV38LoEfEcO/ChSExfH+arDEnPI12HNYxYF6NSZadtzrbPwq/NqBcOPKIT55Mg== From: Kyle Meyer 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> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: kyle@kyleam.com X-TUID: GT1dTx2mIOsa 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)) (point-marker))) (point-max-marker))) base-commit: 9abfc09d24e73044f2392f45fc41169ee4afd72f -- 2.29.2