possible bug + patch for

From: Robbie Dinn (
Date: Thu 18 Sep 2003 - 17:40:02 GMT

  • Next message: Manfred Larcher: "problems with filenames having "," in it!"

    I would like to share my experiences of using the
    script with anomy. I initially had some problems with it, but it now
    seems to be working OK.

    Please bear in mind that I am not a perl programmer, so take anything
    I say with a pinch of salt.

    The patch at the bottom of this message contains three hunks.

    Hunks one and three change a 'concat' to an 'open' instead.
    I don't know what concat does. I can't find it in the perl documentation.
    (It probably there but I can't find it).
    When I run the original script I get an error message like the

       robbie@rjd:~> cp msg6/msg-3327-2.dat ~/foo.dat ; ANOMY=/usr/local/anomy ANOMY_CONF=~/anomy.conf perl foo.dat
       Using an array as a reference is deprecated at /usr/lib/perl5/site_perl/5.8.0/Date/ line 88.
       Using an array as a reference is deprecated at /usr/lib/perl5/site_perl/5.8.0/Date/ line 217.
       Bareword "STDERR" not allowed while "strict subs" in use at line 78.
       Bareword "SAN" not allowed while "strict subs" in use at line 133.
       Execution of aborted due to compilation errors.

    But if I change the concat's to open's, this problem goes away.
    I might have broken something else in the process, but it seems to
    work for me.

    The second of the three hunks changes the call to Convert::TNEF->read_in()

    I am running the perl script in a current working directory (cwd) where it
    does _not_ have permission to create new files. But the Convert::TNEF code
    seems to occasionally want to create temporary files, by default in the cwd.
    If it can't create the temporary file, the script fails and anomy drops the
    whole winmail.dat attachement instead of converting it.

    The change adds an extra parameter to the Convert::TNEF->read_in() call
    to tell it to make the temporary files in the $tempdir instead of the

    I have not passed this information on the the Advosys people yet,
    because I don't have an email address for them and their web site
    appears to be off line. But if someone could pass this on for me, that
    would be welcome.

    I hope this helps.

    Robbie Dinn (robbie at microbus dot com)

    patch follows...

    diff -u2
    --- 2003-09-16 18:27:30.000000000 +0100
    +++ 2003-09-18 14:46:07.000000000 +0100
    @@ -68,5 +68,5 @@
     # Redirect STDOUT if required:
     #if ( $LOGFILE ) {
    -concat(STDERR, ">>$main::LOGFILE") or die "Cannot open log file $main::LOGFILE: $!\n" if $main::LOGFILE;
    +open(STDERR, ">>$main::LOGFILE") or die "Cannot open log file $main::LOGFILE: $!\n" if $main::LOGFILE;
     # Grab name of TNEF file to process:
    @@ -85,5 +85,5 @@
     mkdir $tempdir or die("Can't create directory $tempdir: $!\n");
    -my $tnef = Convert::TNEF->read_in($tneffile) or die $Convert::TNEF::errstr;
    +my $tnef = Convert::TNEF->read_in($tneffile,{output_dir=>"$tempdir"}) or die $Convert::TNEF::errstr;
     my @files = ();
    @@ -123,5 +123,5 @@
     # Quick 'n' dirty way: open a pipe to the sanitizer script:
    -concat(SAN,"|$ANOMY_BIN $ANOMY_CONF > $SPOOLDIR/mime-$$") or die "Can't pipe to $ANOMY_BIN: $!\n";
    +open(SAN,"|$ANOMY_BIN $ANOMY_CONF > $SPOOLDIR/mime-$$") or die "Can't pipe to $ANOMY_BIN: $!\n";
     $top->print(\*SAN) or die "Error piping to $ANOMY_BIN: $!\n";
     close SAN or die "Error piping to $ANOMY_BIN: $!\n";

    hosted by