Rarylson Freitas
2016-Dec-01  17:08 UTC
maildir-size-fix.pl - The file command can wrongly detect gzipped mails as being Minix filesystems
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";
```
--
*Rarylson Freitas*
Timo Sirainen
2016-Dec-02  00:18 UTC
maildir-size-fix.pl - The file command can wrongly detect gzipped mails as being Minix filesystems
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!
Seemingly Similar Threads
- [LLVMdev] [Minix-office] Re: Minix support in googletest
- Minix doesn''t boot on XEN HVM but works with Qemu
- Probe ext2 and ext3 before minix
- [LLVMdev] Minix support in googletest
- [Bug 8313] New: Minix Support - check for netinet/{in_systm,ip}.h and SO_BROADCAST