Re: Applying patches from mailing list

"Kevin J. McCarthy" <[email protected]>
Newsgroups gmane.mail.mutt.devel
Message-ID <aZGfwZa-yosBl96M@qinghai>
On Sun, Feb 15, 2026 at 08:57:44AM +0100, Fabian Groffen wrote:
>On 15-02-2026 10:00:37 +0800, Kevin J. McCarthy wrote:
>> Well, that didn't work.  Apparently, OSUOSL set "munge from" as the
>> default in their config.  When I try to change it, via the web
>> interface, to "accept" I get the error:
>>
>> Error: dmarc_moderation_action must be >= the configured default value.
>
>Yes, but what was the expected result?

Yeah it was just to test.  I made the change myself a few years ago from 
Accept to Munge, so thought I could change it back, just to see how it 
worked now that they are filtering DKIM headers.  But it looks like they 
nailed the option on. :-)

>Perhaps you can share your "hacky macros" that you used in Mutt to deal
>with submissions via the list?

I have macros to copy the messages I want to apply to a different 
mailbox, and to quickly switch to that mailbox.  Those are just standard 
"<copy-message>~/temp/foo<enter>" macros.

The new macro invokes a script via <edit>:

macro index,pager ,pum \
"<enter-command>set my_old_editor=\$editor editor='~/.mutt/bin/unmunge-patch.rb'<enter>\
<edit>\
<enter-command>set editor=\$my_old_editor<enter>"     "Unmunge patch From addr"

I noticed that when the list server munges the From address, it always 
moves the new From address down, immediately followed by a Reply-To set 
to the original address.

So the unmunge script simply drops the From: header if it matches "XXXXX 
via Mutt-dev" and then renames the Reply-To: header to From:.

I'm attaching the script, but please spare me any thrown tomatoes... I 
hacked it together quickly, and it's not designed to be 
bullet-proof. :-P If it fails, I can always <edit> the message manually 
and fix it.

-- 
Kevin J. McCarthy
GPG Fingerprint: 8975 A9B3 3AA3 7910 385C  5308 ADEF 7684 8031 6BDA
unmunge-patch.rb (text/x-ruby, 1.3 KB)
#!/usr/bin/ruby
#
# This is meant to unmunge mutt-dev mailing list patches by simply renaming
# the Reply-To header to the From header if the from header looks like
#   From: XXX XXXX via Mutt-dev <[email protected]>
#
# Right now this script is pretty dumb.  It assumes the from header name part
# will be on the first line and it's not encoded.
#

require 'tempfile'
require 'fileutils'

path = ARGV[0]
temp_file = Tempfile.new('unmunge-patch')

state = :in_headers

drop_header = false
rename_reply_to = false

begin
  File.open(path, 'r') do |file|
    file.each_line do |line|
      case state
      when :in_headers
        case line
        when /^from:\s*.*via mutt-dev/i
          drop_header = true
          rename_reply_to = true
        when /^reply-to:/i
          drop_header = false
          if rename_reply_to
            line.sub!(/^reply-to:/i, "From:")
          end
        when /^[ \t]+/
          # continuation line.
          # continue dropping or not dropping.
        when "\n"
          drop_header = false
          state = :in_body
        else
          drop_header = false
        end
      end

      if !drop_header
        temp_file.puts line
      end
    end
  end

  temp_file.close
  FileUtils.mv(temp_file.path, path)
ensure
  temp_file.close unless temp_file.closed?
  temp_file.unlink # deletes the temp file
end
signature.asc (application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEEiXWpszqjeRA4XFMIre92hIAxa9oFAmmRn8EACgkQre92hIAx
a9qqMg/8CYm4FbF4kD84ZOyLqTeMULgxRLDicwMTz5x8NIyJijGKltwooZY7Esxe
fFlRwLbSFeNbrELuwzcQw0odSz7p5ztV7DkmotOfw78+Y/PjGPaM0XF9heajZLOF
VpdKlzdpBLzgAk0RPVfgmtLZaZe7xkd3uxp65DQLJ9hkFwrbiOPhUwR/LdaOBR8F
hd2BvDRM0k7a6IkK7mIMHXMxmBg3RwyJ95J6sIiMUKbvyGVWK/56Y089tjRGV+Vs
+Co8++hwRHsaQs4tSgJU+bdfYqoXhD930gb7UVRVz+/FwfuyY9LHAvGEL5AT8LUA
yCQwmOIb8VbDKc4I1UgCc6sew7LrlhjY4RyET35+ccEkkvcdhITK4qmEUO24r4qp
fUI92MzgS53VDVcz9LG/O0ZN/SrbBLVwqZtPROW/ODhnoppnvlz7SCOG+lQvvP0V
AoD9bMuL5I631TYAfVVfpvd9glEbqSOdZWNqXdESfbU+5x9PM4kyykCHLpfna1RR
/yL6rL9/G/E2RPfjK7i0L5qvHfeHPx8wep2BenQSleBSnlbcqlpviWGgM7SgG/Jd
5eDN+mOtKcJjfXEslR/bOZ5mPiC6DPzPWo2m4+WIM6XVBarOO03nYLKGQjM3M3Z9
oG+TgEHRKF+U6epuAZ6dIa3CGpOIYQQzNiqjdhz4er3uHi+dP2E=
=l6zQ
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.