Created attachment 591287 [details]
Description of problem:
Ncurses caches the TERMINFO variable incorrectly.
The problem manifests itself when processes change the TERMINFO while a curses session is ongoing.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. mkdir ~/terminfo
2. echo "someterm,use=xterm" > someterm
3. TERMINFO=~/terminfo tic someterm
4. Compile the attached test program:
gcc -Wall -o cursestest cursestest.c -ltinfo
5. Run it:
Created attachment 591288 [details]
Patch curing the issue
This patch fixes the problem for ncurses-5.9-20120204.
Please note that the patch's first hunk fixes a memory allocation problem (the strings returned by getenv() are stored and then freed with free() which is a big no-no), while the second and third hunks actually fix the issue.
Odd - I've run this with valgrind many times without noticing the bug
(since the code is from October). thanks
The faulty code can only trigger if TERMINFO changes during the lifetime of a process, which is not very common.
I happen to do that in my login scripts, to change terminal features transparently (I hate the alternate screen used by vi/less/etc with a passion which I turn-off automagically be defining an alternate terminal derived from the current one), but that's unlikely to be common.
I've also noticed (and maybe I should open another bug for that) that the .spec does NOT clear TERMINFO before running and if you happen to have TERMINFO defined when running rpmbuild, the package build will fail as the install target will try to install terminal definitions in "$DESTDIR$TERMINFO".
You may want to clear (the new) TERMINFO_PATH (sp?) and friends as well.
I added this change on Friday (20120622).
For what it's worth, I wrap my package builds in a script that limits
the environment, leaving only TMPDIR, USER, PATH, HOME and LOGNAME.
I would assume that packagers do the same, more or less.
ncurses-5.9-6.20121013.fc18 has been submitted as an update for Fedora 18.
* should fix your issue,
* was pushed to the Fedora 18 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing ncurses-5.9-6.20121013.fc18'
as soon as you are able to.
Please go to the following url:
then log in and leave karma (feedback).
ncurses-5.9-7.20121017.fc18 has been submitted as an update for Fedora 18.
ncurses-5.9-6.20121013.fc18 has been pushed to the Fedora 18 obsolete repository. If problems still persist, please make note of it in this bug report.