<<< Date Index >>>     <<< Thread Index >>>

folder-hook string length limitation



Hi,

(I'm using today's cvs sources)

While extending my .muttrc, I got:

Error in /home/vm156888/.muttrc, line 267: ( ) or \( \) imbalance
source: errors in /home/vm156888/.muttrc

First problem, this message is misguided as you can see later.

After some debugging I found out that the problem lies in hook.c, around
line 499 (my sources are modified a bit, so I may be off slightly)

int mutt_parse_hook (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER *err)
{
...
  char path[_POSIX_PATH_MAX];    <- 255
...
  if (data & (M_FOLDERHOOK | M_MBOXHOOK))
  {
    strfcpy (path, pattern.data, sizeof (path));
    _mutt_expand_path (path, sizeof (path), 1);
    FREE (&pattern.data);
    memset (&pattern, 0, sizeof (pattern));
    pattern.data = safe_strdup (path);
  } 

My folder hook looks like this:

folder-hook =(mailbox1|mailbox2|....|maiboxX) '...'

and is very, long, currently longer than _POSIX_PATH_MAX

after _mutt_expand_path the string gets shortened into

"imaps://mail\.server\.com/(mailbox1|mailbox2|....|mailbox50|"

That's the reason for ( ) imbalance

I consider this bug, even that I'm not sure if it's bug of the sorce
code or documentation bug or request for enhancement that mutt should
tell you that the string is too long.

My guess would be that limitation to _POSIX_PATH_MAX is wrong, as the
regular expression can be longer even for traditional (directory based)
mailboxes.

Any opinions ?

Thank you

--
        Vladimir

Attachment: pgpGp8jqILT8c.pgp
Description: PGP signature