Subject: bug#11432: Application that sets LINES/COLUMNS env vars behaves weird in term and ansi-term

From: Nikos Chantziaras <[email-masked]>
Date: Tue, 08 May 2012 16:56:03 +0300

I have a curses application (written in C++) that during start-up does:

   static char linesEnv[32];
   static char columnsEnv[32];
   /* Init the above vars */
   putenv(linesEnv);
   putenv(columnsEnv);

linesEnv and columnsEnv contain "LINES=N" and "COLUMNS=N" respectively, 
with N being the current terminal dimensions.

Now this sounds like a totally useless thing to do; why would you set 
these env vars if they're already set.  This is done in order to work 
around a bug in an old Solaris version.  But on other systems, this 
should have no effect.

But with emacs it does have an effect; the application's output is all 
messed up.  Characters appear in wrong places or entirely missing and 
everything is pretty much messed up.  I modified the program to not 
export the env vars when TERM=eterm (or eterm-color).  But in case this 
is a bug in Emacs, I'm reporting it here.

I'm using GNU Emacs 23.4.2 built without X support, with Ncurses 5.9 on 
Gentoo AMD64.  The problem also appears in Emacs 23.1 with X support on 
Ubuntu 10.04 (which is the system of the user who reported the problem 
to me.)