Re: [Mailman-Developers] Stripping binaries attachments
At 05:28 PM 4/19/02 -0400, Barry A. Warsaw wrote:
bin/dumpdb knows how to print out the plaintext representation of a .pck message file, so
% bin/dumpdb qfiles/in/...pck > msg.txt
ought to do the trick. The other direction is fairly easy if you don't mind not saving the message metadata file (.db). Use bin/inject, possibly with the -q option.
And, you know, I actually knew that at the time, and now that you've mentioned it again, realize I actually did that eventually...
Although I hadn't thought about using inject to shove it back in.
Inject has given me problems, unless I go and remove some magic header manually (well, with sed); IIRC, it was X-BeenThere.
Here are a couple of scripts I find useful for manually investigating bad or shunt messages:
Create symlinks to all the shunted messages' .pck and .db files, in ~mailman, for investigation with debugshunt.py
$ cat ~/bin/linkshunt #!/bin/ksh i=0 for f in $(ls qfiles/shunt/*pck); do ip=$(printf %03s $i) base=$(basename $f .pck) ln -s qfiles/shunt/${base}.pck shunt${ip}.pck ln -s qfiles/shunt/${base}.db shunt${ip}.db ((i=i+1)) done
Set up some gunge to poke around shunted messages by hand (particularly when they won't parse, so dumpdb is no help). Create a msg object from argv[1], and have a pp function around for pretty-printing various things as you poke, then start an interactive console:
$ cat debugshunt.py #!/usr/local/bin/python import sys sys.path.insert(0, './bin') import paths import cPickle import pprint import code
f=open(sys.argv[1]) msg=cPickle.load(f) pp=pprint.PrettyPrinter().pprint
try: import readline except ImportError: pass namespace = globals().copy() namespace.update(locals()) code.InteractiveConsole(namespace).interact("got console?")
participants (1)
-
Dan Mick