Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sidebar.c fails with lvalue error #131

Open
LMariachi opened this issue Apr 9, 2016 · 6 comments
Open

sidebar.c fails with lvalue error #131

LMariachi opened this issue Apr 9, 2016 · 6 comments

Comments

@LMariachi
Copy link

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

@flatcap
Copy link
Contributor

flatcap commented Apr 9, 2016

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
Copy link
Contributor

flatcap commented Apr 9, 2016

@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.

@LMariachi
Copy link
Author

Nope, same error as before.

@flatcap
Copy link
Contributor

flatcap commented Apr 12, 2016

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

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

@LMariachi
Copy link
Author

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

mutt.out.zip

@flatcap
Copy link
Contributor

flatcap commented Apr 12, 2016

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants