Package: mimedecode
Version: 1.9-4
Severity: normal

It took just somewhat over 4 years for someone to look into this bug :(
I suppose noone's interested in fixing it :(

Michele,

as you already discovered, the expression you used:

        SUB=`formail -zx Subject: | mimedecode`

won't be useful.  But I guess something like this:

        SUB=`formail -czx Subject: | sed -e 's/^/x /' | \
                (mimedecode || :) | cut -d' ' -f2-`

might.

Thing is mimedecode will ignore non-header stuff.  As you already
disovered, sticking anything (space character separated) in front
of the subject, will fool mimedecode and it will look like a header
to it :(

Alternatively, some perl script simplier than this:

---8<---
#!/usr/bin/perl -w

use strict;
use Getopt::Std;
use Email::MIME::Modifier;

my %opts;
getopts('dH:', \%opts) or
        die "getopts failed,";

my @text;
if ($opts{'d'}) {
        die "E: missing file name argument,"
                unless $ARGV[0];
        die "E: file $ARGV[0] not found,"
                unless -r $ARGV[0];

        open(EMAIL, "< $ARGV[0]") or
                die "E: failed reading file $ARGV[0],";
        @text = <EMAIL>;
        close(EMAIL);
} else {
        @text = <>;
}

my $hdr = $opts{'H'};
$hdr = "Subject"
        unless $hdr;

my $email = Email::MIME->new(join('', @text));
foreach my $s ($email->header($hdr)) {
        $s =~ s|\s+| |g;
        $s =~ s|^\s+||;
        $s =~ s|\s+$||;
        print($s, "\n");
}

exit(0);
---8<---

will do the job.

-- System Information:
Debian Release: squeeze/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing')
Architecture: i386 (i686)

Kernel: Linux 2.6.26-2-686 (SMP w/2 CPU cores)
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)
Shell: /bin/sh linked to /bin/bash

Versions of packages mimedecode depends on:
ii  libc6                         2.9-12     GNU C Library: Shared libraries

mimedecode recommends no packages.

mimedecode suggests no packages.

-- no debconf information

Cheers,

-- 
Cristian



-- 
To UNSUBSCRIBE, email to debian-qa-packages-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to