#837045 mutt: wrong handling of symbol '>' in conditional expression

Package:
mutt
Source:
mutt
Description:
text-based mailreader supporting MIME, GPG, PGP and threading
Submitter:
Andrey Skvortsov
Date:
2022-06-13 07:45:12 UTC
Severity:
normal
Tags:
#837045#5
Date:
2016-09-08 08:18:25 UTC
From:
To:
Dear Maintainer,

after upgrading from mutt 1.6.0-1 to mutt 1.7.0-1 (NeoMutt) in testing I see
following regression.

I have this setting in my muttrc
set index_format="%4C | %Z [%D] %-35.35F (%-4.4c) %?M?<%M> ?%s"

The problem is in part '%?M?<%M> ?'. Number of hidden messages in thread are
only shown it thread is collapsed, like this '<10>'.
If thread is not collapsed and no messages are hidden, then nothig should be
shown.
So it worked on mutt 1.6.0.

In NeoMutt 1.7.0 I see following issue. With the same index_format if thread is
not collapsed ' >' is shown.


If index_format is modified to
"%4C | %Z [%D] %-35.35F (%-4.4c) %?M?before>after?%s"

In mutt 'after>' is shown, there nothing should be shown at all.
If I replace with '>' there with any other character, then all works correctly
as before, nothing is shown if thread is not collapsed.

It looks like mutt takes all characters after '>' in if_string, prints they
regardless of condition value and appends at the end symbol '>'.

#837045#10
Date:
2016-09-08 10:37:01 UTC
From:
To:
Hi Andrey,

Thanks for the bug report.
Mutt allows you to nest conditionals, but the syntax is very scary --
requiring a LOT of escaping.

The solution was nested-if, which introduces the %<> notation.
I've attempted to document it, here:
http://www.neomutt.org/feature/nested-if/

I haven't decided how to fix this problem, yet, so you have two options.
Escape the <> chars, or choose different ones.

The upstream (NeoMutt) bug is tracked, here:
https://github.com/neomutt/neomutt/issues/113

Cheers,
    Rich / FlatCap
    NeoMutt maintainer

#837045#15
Date:
2016-09-08 10:37:01 UTC
From:
To:
Hi Andrey,

Thanks for the bug report.
Mutt allows you to nest conditionals, but the syntax is very scary --
requiring a LOT of escaping.

The solution was nested-if, which introduces the %<> notation.
I've attempted to document it, here:
http://www.neomutt.org/feature/nested-if/

I haven't decided how to fix this problem, yet, so you have two options.
Escape the <> chars, or choose different ones.

The upstream (NeoMutt) bug is tracked, here:
https://github.com/neomutt/neomutt/issues/113

Cheers,
    Rich / FlatCap
    NeoMutt maintainer

#837045#20
Date:
2016-09-08 10:48:40 UTC
From:
To:
Thanks for the info.
For myself I just choose different characters instead of '<' and '>'.

#837045#25
Date:
2016-09-08 10:48:40 UTC
From:
To:
Thanks for the info.
For myself I just choose different characters instead of '<' and '>'.

#837045#36
Date:
2022-05-06 21:43:04 UTC
From:
To:
Mutt no longer contains the NeoMutt patches, and doesn't contain the
nested conditionals patch that caused this issue.

(Instead Mutt added the index-format-hook feature).