Re: feature freeze? (Re: [Announce] mutt-1.5.13 is out)
Hi,
* Matthew D. Fuller [06-08-17 00:34:44 -0500] wrote:
Oh, much more than a 1-liner (which was part of the argument).
Different functions get called for gdbm vs bdb etc, so it had to be
repeated in a number of places. It could probably be factored down to
something a little cleaner (a few possibilities occur to me just
glancing at it), but since it works for me.
Ouch, but sorry, the patch can be done much simpler and much more
efficient (calling functions like strdup() always involves
malloc()/free() which should be avoided as much as possible because
they're horribly expensive).
The way to do it IMHO is this: in mutt_hcache_per_folder() you only need
to change the way the MD5 sum is computed to strip the trailig /. The
reason is that we only want to get rid of it for the MD5-based database
filename so that a folder with and without the trailing slash gets has
the MD5 sum; we really want to ignore everything else for fixing this
problem. There, you can do this:
char tmp[_POSIX_PATH_MAX];
strfcpy(tmp,folder,sizeof(tmp));
size_t tmplen=mutt_strlen(tmp);
if (tmp[tmplen-1]=='/') tmp[--templen]=0;
MD5Update(&md5, tmp, tmplen);
(untested, of course) and that should be pretty much it.
(The one-liner idea was stupid as we shouldn't mangle the folder
variable's contents in there)
Opinions?
bye, Rocco
--
:wq!