maildir-size-fix.pl - The file command can wrongly detect gzipped mails as being Minix filesystems

Timo Sirainen tss at iki.fi
Fri Dec 2 00:18:59 UTC 2016


On 1 Dec 2016, at 19.08, Rarylson Freitas <rarylson at gmail.com> wrote:
> 
> Hi,
> 
> Some days ago, I have used the maildir-size-fix.pl script (cited in this
> mail thread: http://www.dovecot.org/list/dovecot/2013-January/087942.html,
> in available here:
> http://dovecot.org/tools/maildir-size-fix.pl).
> 
> This is a very good script and helped me a lot!
> 
> However, some compressed mails where misdetected as non-compressed mail. So
> I discovered that some versions of the file command (some old versions) can
> wrongly detect gzipped files as being Minix filesystems.
> 
> Actually, the error was occurring in about 1 gzipped mail for each 60000 or
> 100000 mails.
> 
> I reported this file command bug here:
> https://bugs.launchpad.net/ubuntu/+source/file/+bug/1646233.
> 
> But I think it's worth to make a small improvement in maildir-size-fix.pl,
> making it more error prone. What do you, guys, think about this?
> 
> This is the patch I'm proposing:
> 
> ```
> --- maildir-size-fix.pl.orig    2016-12-01 14:41:30.044689101 -0200
> +++ maildir-size-fix.pl    2016-12-01 14:49:42.971197715 -0200
> @@ -37,7 +37,10 @@
> 
>     return $stat[7];
>   }
> -  my $type=`file "$path"`;
> +  # Detecting all possible types (keep going) since some versions of the
> file
> +  # command can wrong detect gzip files as Minix filesystems.
> +  # See: https://bugs.launchpad.net/ubuntu/+source/file/+bug/1646233
> +  my $type=`file -k "$path"`;
>   my $program = "";
>   if ($type =~ /gzip/) {
>     $program = "gunzip";
> 
> ```

Added, thanks!



More information about the dovecot mailing list