Re: [PATCH] Fix const warnings on Arch linux with the latest glibc.

Rene Kita <[email protected]>
Newsgroups gmane.mail.mutt.devel
Message-ID <[email protected]>
On Wed, Feb 25, 2026 at 11:43:18AM +0100, Rene Kita wrote:
> On Wed, Feb 25, 2026 at 05:57:24PM +0800, Kevin J. McCarthy wrote:
> > The latest version changes string search functions, such as strchr()
> > and strrchr(), so that the return type is the same type as the string
> > passed in.
> > 
> > This helped us catch a real bug in browser.c (3a8dfafc), and also
> > turned up some variable type issues, fixed here.
> > 
> > Thanks to Rene Kita for the work on the Arch sr.ht build files which
> > turned up the bugs, and for an initial patch showing where the warning
> > were, which this commit is based upon.
> > 
> > Also thanks to Alejandro Colomar for quickly explaining what was going
> > on and helping debug the issues.
> > ---
> >  mh.c      |  6 ++++--
> >  muttlib.c |  3 ++-
> >  parse.c   |  5 +++--
> >  rfc1524.c |  7 ++++---
> >  sendlib.c |  3 ++-
> >  url.c     | 10 ++++++----
> >  6 files changed, 21 insertions(+), 13 deletions(-)
> 
> LGTM! Works in sr.ht CI with one more minor problem, which was not on my
> list.

This was actually incorrect. There are still two other problems
concerning const. I was in a hurry, sorry for that.

util.c: In function ‘imap_parse_path’:
util.c:368:7: error: assignment discards ‘const’ qualifier from pointer target
type [-Werror=discarded-qualifiers]
  368 |     c = strchr (path, '}');
      |       ^
util.c: In function ‘imap_get_literal_count’:
util.c:614:20: error: assignment discards ‘const’ qualifier from pointer target
type [-Werror=discarded-qualifiers]
  614 |   if (!buf || !(pc = strchr (buf, '{')))
      |                    ^

This is in imap/util.c and needs:
./configure --enable-gpgme --enable-pop --enable-imap \
  --enable-smtp --enable-hcache --enable-sidebar \
  --without-included-gettext --with-mailpath=/var/spool/mail \
  --with-curses --with-ssl --with-sasl --with-idn2

From I quick look I think in the first case we don't need to write to
*c, but making it const gives another error when passing it to
url_parse_ciss.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.