[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#37564: [PATCH] don't export LINES and COLUMNS env vars in term to fi
From: |
Matthew Leach |
Subject: |
bug#37564: [PATCH] don't export LINES and COLUMNS env vars in term to fix ncurses applications |
Date: |
Tue, 01 Oct 2019 16:47:35 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) |
Eli Zaretskii <eliz@gnu.org> writes:
>> From: Matthew Leach <matthew@mattleach.net>
>> Date: Mon, 30 Sep 2019 20:59:04 +0100
>>
>> The attached patch removes the exporting of the LINES and COLUMNS
>> environment variables in term-mode. Exporting these variables causes
>> issues for ncurses applications. For example, when running:
>>
>> emacs -Q
>> M-x term
>> <ret> (to select /bin/bash)
>> htop (to run htop)
>>
>> and resizing the window (especially making it smaller) can make the
>> program impossible to read.
>
> Thanks, but I don't think we can make this change unconditionally,
> because not all applications that heed LINES and COLUMNS use ncurses.
I'm curious as to which programs you are referring? AFAIK, if a program
tries to read the LINES and COLUMNS environment variables, using
`getenv()', they don't exist. Running 'echo $LINES' on a bash terminal
seems to actually do an ioctl to obtain the value of LINES.
Nevertheless, if a program does read the LINES and COLUMNS variables,
these values will be wrong if the window has been resized (try and
compile the attached C snippet and run in term mode while resizing the
window). Should that be considered as a separate bug?
> I wonder if we can do better than just providing a defcustom.
I could make this a defcustom if that would get the patch in?
Thanks,
--
Matt
#include <stdio.h>
#include <signal.h>
#include <unistd.h>
#include <sys/ioctl.h>
void handle_sig()
{
struct winsize w;
ioctl(STDOUT_FILENO, TIOCGWINSZ, &w);
printf("getenv: %s %s\n", getenv("LINES"), getenv("COLUMNS"));
printf("ioctl: %d %d\n", w.ws_row, w.ws_col);
}
int main()
{
signal(SIGWINCH, handle_sig);
fgetc(stdin);
return 0;
}
- bug#37564: [PATCH] don't export LINES and COLUMNS env vars in term to fix ncurses applications, Eli Zaretskii, 2019/10/01
- bug#37564: [PATCH] don't export LINES and COLUMNS env vars in term to fix ncurses applications,
Matthew Leach <=
- bug#37564: [PATCH] don't export LINES and COLUMNS env vars in term to fix ncurses applications, Eli Zaretskii, 2019/10/01
- bug#37564: [PATCH] don't export LINES and COLUMNS env vars in term to fix ncurses applications, Matthew Leach, 2019/10/01
- bug#37564: [PATCH] don't export LINES and COLUMNS env vars in term to fix ncurses applications, Eli Zaretskii, 2019/10/01
- bug#37564: [PATCH] don't export LINES and COLUMNS env vars in term to fix ncurses applications, Eli Zaretskii, 2019/10/01
- bug#37564: [PATCH] don't export LINES and COLUMNS env vars in term to fix ncurses applications, Matthew Leach, 2019/10/01
- bug#37564: [PATCH] don't export LINES and COLUMNS env vars in term to fix ncurses applications, Eli Zaretskii, 2019/10/01
- bug#37564: [PATCH] don't export LINES and COLUMNS env vars in term to fix ncurses applications, Glenn Morris, 2019/10/03
- bug#37564: [PATCH] don't export LINES and COLUMNS env vars in term to fix ncurses applications, Matthew Leach, 2019/10/04
- bug#37564: [PATCH] don't export LINES and COLUMNS env vars in term to fix ncurses applications, Matthew Leach, 2019/10/04
- bug#37564: [PATCH] don't export LINES and COLUMNS env vars in term to fix ncurses applications, Lars Ingebrigtsen, 2019/10/07