mutt-kz icon indicating copy to clipboard operation
mutt-kz copied to clipboard

sidebar.c fails with lvalue error

Open LMariachi opened this issue 8 years ago • 6 comments

sidebar.c: In function ‘make_sidebar_entry’:
sidebar.c:313:7: error: lvalue required as left operand of assignment
  COLS = width + SidebarWidth;
       ^
sidebar.c:315:7: error: lvalue required as left operand of assignment
  COLS = oc;
       ^

I changed

 /* Temporarily lie about the screen width */
     int oc = COLS;
     COLS = width + SidebarWidth;
     mutt_FormatString (buf, buflen, 0, NONULL(SidebarFormat), cb_format_str, (unsigned long) &sbe, 0);
     COLS = oc;

to

     /* Temporarily lie about the screen width */
     int oc;
     oc = width + SidebarWidth;
     mutt_FormatString (buf, buflen, 0, NONULL(SidebarFormat), cb_format_str, (unsigned long) &sbe, 0);

and things seem to work.

sidebar.c.diff.zip

LMariachi avatar Apr 09 '16 00:04 LMariachi

Oh dear. That's worrying. The COLS variable is part of ncurses and is hard-coded throughout mutt. Sidebar temporarily changes its value so that mutt_FormatString gets the width right.

I shall go away and have a think about what to do...

flatcap avatar Apr 09 '16 02:04 flatcap

@LMariachi OK, I searched through the ncurses headers and found what the problem is. Your version of ncurses is reentrant. In the non-reentrant (single-threaded) version COLS is an integer (which I can set). In the reentrant (multithreaded) version COLS is a function (which obviously can't be set).

Please try adding this near the top of mutt_curses.h and let me know if it makes a difference.

#if defined (__CYGWIN__)
#define NCURSES_REENTRANT 0
#endif

Bedtime, now.

flatcap avatar Apr 09 '16 03:04 flatcap

Nope, same error as before.

LMariachi avatar Apr 12 '16 00:04 LMariachi

Hmm... Starting again with clean source, please try:

autoreconf -i; ./configure --enable-sidebar CFLAGS="-DNCURSES_REENTRANT=0"; make

flatcap avatar Apr 12 '16 00:04 flatcap

Had to add --with-homespool=~/mbox to the configure line, but the build failed anyway. Output attached.

mutt.out.zip

LMariachi avatar Apr 12 '16 01:04 LMariachi

OK, this isn't going to work. Thanks for your debugging. I'll keep thinking...

flatcap avatar Apr 12 '16 02:04 flatcap