[PATCH 07/15] Encode utf-8 argument for md5 function

Łukasz Żarnowiecki dolohow at outlook.com
Fri May 13 06:44:02 UTC 2016


On Tue, May 10, 2016 at 02:37:43AM +0200, Nicolas Sebrecht wrote:
> On Tue, May 10, 2016 at 01:18:29AM +0200, Łukasz Żarnowiecki wrote:
> > Python3 accepts binary input for md5 function.
> > 
> > Signed-off-by: Łukasz Żarnowiecki <dolohow at outlook.com>
> > ---
> >  offlineimap/folder/Maildir.py | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/offlineimap/folder/Maildir.py b/offlineimap/folder/Maildir.py
> > index bda452a..95e2553 100644
> > --- a/offlineimap/folder/Maildir.py
> > +++ b/offlineimap/folder/Maildir.py
> > @@ -71,7 +71,7 @@ class MaildirFolder(BaseFolder):
> >          # Everything up to the first comma or colon (or ! if Windows):
> >          self.re_prefixmatch = re.compile('([^'+ self.infosep + ',]*)')
> >          # folder's md, so we can match with recorded file md5 for validity.
> > -        self._foldermd5 = md5(self.getvisiblename()).hexdigest()
> > +        self._foldermd5 = md5(self.getvisiblename().encode('utf-8')).hexdigest()
> 
> I'm not sure about that. I know users out there are using tricks to
> enable UTF-8 encoded names. I guess the MD5 will change. This was never
> officially supported but I know that if the MD5 changes here this will
> harm them.
> 
> I wonder it's time to update the --migrate-md5-using-nametrans to a more
> generic version. Or introduce yet another CLI option. I don't know.

Yes, it will definetely breaks the current setups.  I can think of three
possible solutions:

* Somehow detect that we are comming from offlineimap 6.7 and rewrite the
  names.
* Introduce CLI option as you suggested to make a migration.  This is
	definetely worse approach than previous one, users should be careful enough
	to read release news and let's be hones, they won't.
* Forget about the names and let's break the setups.



More information about the OfflineIMAP-project mailing list