From debbugs-submit-bounces@debbugs.gnu.org Mon Sep 30 15:59:18 2019 Received: (at submit) by debbugs.gnu.org; 30 Sep 2019 19:59:18 +0000 Received: from localhost ([127.0.0.1]:60535 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iF1pF-0004Y7-QE for submit@debbugs.gnu.org; Mon, 30 Sep 2019 15:59:18 -0400 Received: from lists.gnu.org ([209.51.188.17]:42093) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iF1pE-0004Xy-8Q for submit@debbugs.gnu.org; Mon, 30 Sep 2019 15:59:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42086) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iF1pC-0004zR-R4 for bug-gnu-emacs@gnu.org; Mon, 30 Sep 2019 15:59:16 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,URIBL_BLOCKED autolearn=disabled version=3.3.2 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iF1pA-0001ms-Df for bug-gnu-emacs@gnu.org; Mon, 30 Sep 2019 15:59:13 -0400 Received: from mx0.mattleach.net ([176.58.118.143]:60130) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1iF1pA-0001lL-5p for bug-gnu-emacs@gnu.org; Mon, 30 Sep 2019 15:59:12 -0400 Received: by mx0.mattleach.net (Postfix, from userid 99) id 97FCE61C5D; Mon, 30 Sep 2019 20:59:07 +0100 (BST) Received: from hopton.mattleach.net (92.40.249.172.threembb.co.uk [92.40.249.172]) by mx0.mattleach.net (Postfix) with ESMTPSA id 3111961C21 for ; Mon, 30 Sep 2019 20:59:06 +0100 (BST) From: Matthew Leach To: bug-gnu-emacs@gnu.org Subject: [PATCH] don't export LINES and COLUMNS env vars in term to fix ncurses applications User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Date: Mon, 30 Sep 2019 20:59:04 +0100 Message-ID: <87y2y5lfnb.fsf@1e0.co.uk> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 176.58.118.143 X-Spam-Score: -1.4 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.4 (--) --=-=-= Content-Type: text/plain Hi all, 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 (to select /bin/bash) htop (to run htop) and resizing the window (especially making it smaller) can make the program impossible to read. The ncurses code uses an ioctl() initially to get the current size[1] which returns a correct result. However, since we exported the above environment variables these values are discarded in favour of the (now stale) values of LINES and COLUMNS. Emacs makes no attempt to update these variables when the window is resized. Therefore, ncurses assumes the window size is the same when it has actually changed. Note that executing: $ echo $LINES from a bash shell actually doesn't get the LINES environment variable as can be seen with: $ printenv | grep LINES Whenever $LINES is accessed, bash translates this into an ioctl() and returns the result. Therefore, removing these variables shouldn't prevent any shell scripts from accessing these variables. [1]: ncurses/ncurses/tinfo/lib_setup.c (_nc_get_screensize) --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-don-t-export-LINES-and-COLUMNS-env-vars-to-term.patch >From 20b1adff1c32cfeeba1cf3101b05d5c76037206d Mon Sep 17 00:00:00 2001 From: Matthew Leach Date: Mon, 30 Sep 2019 20:35:54 +0100 Subject: [PATCH] don't export LINES and COLUMNS env vars to term * lisp/term.el (term-exec-1): Remove the exporting of the LINES and COLUMNS environment variables to the terminal process. --- lisp/term.el | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lisp/term.el b/lisp/term.el index 66ae470239a..e309bd802d5 100644 --- a/lisp/term.el +++ b/lisp/term.el @@ -1550,9 +1550,7 @@ term-exec-1 (format term-termcap-format "TERMCAP=" term-term-name term-height term-width) - (format "INSIDE_EMACS=%s,term:%s" emacs-version term-protocol-version) - (format "LINES=%d" term-height) - (format "COLUMNS=%d" term-width)) + (format "INSIDE_EMACS=%s,term:%s" emacs-version term-protocol-version)) process-environment)) (process-connection-type t) ;; We should suppress conversion of end-of-line format. -- 2.23.0 --=-=-= Content-Type: text/plain -- Matt --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Tue Oct 01 02:01:15 2019 Received: (at 37564) by debbugs.gnu.org; 1 Oct 2019 06:01:15 +0000 Received: from localhost ([127.0.0.1]:60789 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iFBDm-000372-Mp for submit@debbugs.gnu.org; Tue, 01 Oct 2019 02:01:15 -0400 Received: from eggs.gnu.org ([209.51.188.92]:33224) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iFBDk-00036q-U3 for 37564@debbugs.gnu.org; Tue, 01 Oct 2019 02:01:13 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:55042) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1iFBDf-0000RR-GQ; Tue, 01 Oct 2019 02:01:07 -0400 Received: from [176.228.60.248] (port=3778 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1iFBDe-0003BH-4a; Tue, 01 Oct 2019 02:01:07 -0400 Date: Tue, 01 Oct 2019 09:01:04 +0300 Message-Id: <83eezxatsv.fsf@gnu.org> From: Eli Zaretskii To: Matthew Leach In-reply-to: <87y2y5lfnb.fsf@1e0.co.uk> (message from Matthew Leach on Mon, 30 Sep 2019 20:59:04 +0100) Subject: Re: bug#37564: [PATCH] don't export LINES and COLUMNS env vars in term to fix ncurses applications References: <87y2y5lfnb.fsf@1e0.co.uk> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 37564 Cc: 37564@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Matthew Leach > 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 > (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 wonder if we can do better than just providing a defcustom. From debbugs-submit-bounces@debbugs.gnu.org Tue Oct 01 11:47:42 2019 Received: (at 37564) by debbugs.gnu.org; 1 Oct 2019 15:47:42 +0000 Received: from localhost ([127.0.0.1]:34461 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iFKNK-0002Qs-3G for submit@debbugs.gnu.org; Tue, 01 Oct 2019 11:47:42 -0400 Received: from mx0.mattleach.net ([176.58.118.143]:51342) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iFKNH-0002Qj-Gw for 37564@debbugs.gnu.org; Tue, 01 Oct 2019 11:47:41 -0400 Received: by mx0.mattleach.net (Postfix, from userid 99) id 66D8661C5D; Tue, 1 Oct 2019 16:47:38 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mx0.mattleach.net X-Spam-Level: X-Spam-Status: No, score=-1.0 required=4.0 tests=ALL_TRUSTED,URIBL_BLOCKED autolearn=disabled version=3.4.2 Received: from hopton.mattleach.net (92.40.249.172.threembb.co.uk [92.40.249.172]) by mx0.mattleach.net (Postfix) with ESMTPSA id 98DAB61C21; Tue, 1 Oct 2019 16:47:37 +0100 (BST) From: Matthew Leach To: Eli Zaretskii Subject: Re: bug#37564: [PATCH] don't export LINES and COLUMNS env vars in term to fix ncurses applications In-Reply-To: <83eezxatsv.fsf@gnu.org> (Eli Zaretskii's message of "Tue, 01 Oct 2019 09:01:04 +0300") References: <87y2y5lfnb.fsf@1e0.co.uk> <83eezxatsv.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Date: Tue, 01 Oct 2019 16:47:35 +0100 Message-ID: <87tv8slb6w.fsf@mattleach.net> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 37564 Cc: 37564@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain Eli Zaretskii writes: >> From: Matthew Leach >> 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 >> (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 --=-=-= Content-Type: text/plain Content-Disposition: inline; filename=winch2.c #include #include #include #include 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; } --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Tue Oct 01 12:07:39 2019 Received: (at 37564) by debbugs.gnu.org; 1 Oct 2019 16:07:39 +0000 Received: from localhost ([127.0.0.1]:34555 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iFKgd-00057p-6O for submit@debbugs.gnu.org; Tue, 01 Oct 2019 12:07:39 -0400 Received: from eggs.gnu.org ([209.51.188.92]:43416) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iFKgb-00057c-0m for 37564@debbugs.gnu.org; Tue, 01 Oct 2019 12:07:37 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:35729) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1iFKgV-0006ft-5s; Tue, 01 Oct 2019 12:07:31 -0400 Received: from [176.228.60.248] (port=1401 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1iFKgU-0006f1-H5; Tue, 01 Oct 2019 12:07:31 -0400 Date: Tue, 01 Oct 2019 19:07:30 +0300 Message-Id: <83a7aka1q5.fsf@gnu.org> From: Eli Zaretskii To: Matthew Leach In-reply-to: <87tv8slb6w.fsf@mattleach.net> (message from Matthew Leach on Tue, 01 Oct 2019 16:47:35 +0100) Subject: Re: bug#37564: [PATCH] don't export LINES and COLUMNS env vars in term to fix ncurses applications References: <87y2y5lfnb.fsf@1e0.co.uk> <83eezxatsv.fsf@gnu.org> <87tv8slb6w.fsf@mattleach.net> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 37564 Cc: 37564@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Matthew Leach > Cc: 37564@debbugs.gnu.org > Date: Tue, 01 Oct 2019 16:47:35 +0100 > > > 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. What makes you say that? Emacs exports these variables into the environment that is passed to child subprocesses, so those subprocesses will definitely see them using getenv. > 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? We nowadays have window-adjust-process-window-size-function to support that, and term.el is using that. So why isn't it working for you? Maybe you are running a version of Emacs that's too old (AFAICT, you didn't say which one)? From debbugs-submit-bounces@debbugs.gnu.org Tue Oct 01 14:33:41 2019 Received: (at 37564) by debbugs.gnu.org; 1 Oct 2019 18:33:41 +0000 Received: from localhost ([127.0.0.1]:34749 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iFMxx-0002MS-0n for submit@debbugs.gnu.org; Tue, 01 Oct 2019 14:33:41 -0400 Received: from mx0.mattleach.net ([176.58.118.143]:52748) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iFMxu-0002MJ-Bw for 37564@debbugs.gnu.org; Tue, 01 Oct 2019 14:33:39 -0400 Received: by mx0.mattleach.net (Postfix, from userid 99) id 6C2C161C5D; Tue, 1 Oct 2019 19:33:37 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mx0.mattleach.net X-Spam-Level: X-Spam-Status: No, score=-1.0 required=4.0 tests=ALL_TRUSTED,URIBL_BLOCKED autolearn=disabled version=3.4.2 Received: from hopton.mattleach.net (92.40.249.172.threembb.co.uk [92.40.249.172]) by mx0.mattleach.net (Postfix) with ESMTPSA id 8F4CD61C21; Tue, 1 Oct 2019 19:33:36 +0100 (BST) From: Matthew Leach To: Eli Zaretskii Subject: Re: bug#37564: [PATCH] don't export LINES and COLUMNS env vars in term to fix ncurses applications In-Reply-To: <83a7aka1q5.fsf@gnu.org> (Eli Zaretskii's message of "Tue, 01 Oct 2019 19:07:30 +0300") References: <87y2y5lfnb.fsf@1e0.co.uk> <83eezxatsv.fsf@gnu.org> <87tv8slb6w.fsf@mattleach.net> <83a7aka1q5.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) Date: Tue, 01 Oct 2019 19:33:39 +0100 Message-ID: <87sgocfh8c.fsf@mattleach.net> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 37564 Cc: 37564@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Eli Zaretskii writes: >> From: Matthew Leach >> Cc: 37564@debbugs.gnu.org >> Date: Tue, 01 Oct 2019 16:47:35 +0100 >> >> > 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. > > What makes you say that? If I run the C program in my previous post in an xterm and resize I get: getenv: (null) (null) ioctl: 24 80 getenv: (null) (null) ioctl: 42 169 You can see that doing getenv() on LINES and COLUMNS returns a null pointer. I've tested this same behaviour on gnome-terminal and numerous other terminal emulators. > Emacs exports these variables into the environment that is passed to > child subprocesses, so those subprocesses will definitely see them > using getenv. I'm no expert on how these things work but it doesn't appear to be the way that it's done, on my machine anyway. Perhaps there are programs that uses these variables on MacOS or Windows? >> 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? > > We nowadays have window-adjust-process-window-size-function to support > that, and term.el is using that. So why isn't it working for you? > Maybe you are running a version of Emacs that's too old (AFAICT, you > didn't say which one)? I'm testing this on the latest Emacs Git version. I can see that window-adjust-process-window-size-function is used in term.el however, this doesn't appear to update the environment variables exported to the terminal process. If I run the same program with term on Emacs git and resize I get: getenv: 31 80 ioctl: 30 89 getenv: 31 80 ioctl: 30 90 getenv: 31 80 ioctl: 30 91 getenv: 31 80 ioctl: 31 92 getenv: 31 80 ioctl: 31 93 getenv: 31 80 ioctl: 31 94 ... Notice that the values returned by getenv don't change. Given that this functionality is broken, I'm suggesting that we don't export the variables. This will make ncurses fall back to using ioctls for window size inspection. Another way to fix this would be to somehow update the environment variables that are exported to the process. What are your thoughts? Thanks, -- Matt From debbugs-submit-bounces@debbugs.gnu.org Tue Oct 01 14:58:57 2019 Received: (at 37564) by debbugs.gnu.org; 1 Oct 2019 18:58:57 +0000 Received: from localhost ([127.0.0.1]:34769 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iFNMO-00030s-La for submit@debbugs.gnu.org; Tue, 01 Oct 2019 14:58:56 -0400 Received: from eggs.gnu.org ([209.51.188.92]:35301) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iFNML-00030c-Ni for 37564@debbugs.gnu.org; Tue, 01 Oct 2019 14:58:55 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:38984) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1iFNMG-0005Tk-9H; Tue, 01 Oct 2019 14:58:48 -0400 Received: from [176.228.60.248] (port=3833 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1iFNMD-0004ng-0M; Tue, 01 Oct 2019 14:58:47 -0400 Date: Tue, 01 Oct 2019 21:58:25 +0300 Message-Id: <83y2y48f8u.fsf@gnu.org> From: Eli Zaretskii To: Matthew Leach In-reply-to: <87sgocfh8c.fsf@mattleach.net> (message from Matthew Leach on Tue, 01 Oct 2019 19:33:39 +0100) Subject: Re: bug#37564: [PATCH] don't export LINES and COLUMNS env vars in term to fix ncurses applications References: <87y2y5lfnb.fsf@1e0.co.uk> <83eezxatsv.fsf@gnu.org> <87tv8slb6w.fsf@mattleach.net> <83a7aka1q5.fsf@gnu.org> <87sgocfh8c.fsf@mattleach.net> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 37564 Cc: 37564@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Matthew Leach > Cc: 37564@debbugs.gnu.org > Date: Tue, 01 Oct 2019 19:33:39 +0100 > > >> 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. > > > > What makes you say that? > > If I run the C program in my previous post in an xterm and resize I get: > > getenv: (null) (null) > ioctl: 24 80 > getenv: (null) (null) > ioctl: 42 169 > > You can see that doing getenv() on LINES and COLUMNS returns a null > pointer. I've tested this same behaviour on gnome-terminal and numerous > other terminal emulators. I simply tried "env | fgrep LINES" and I do see the variable, although it wasn't there before I launched Emacs. 'env' is just another program accessing the environment, right? I have no idea why your test program doesn't see that, but then I'm far from being an expert on these issues. > > Emacs exports these variables into the environment that is passed to > > child subprocesses, so those subprocesses will definitely see them > > using getenv. > > I'm no expert on how these things work but it doesn't appear to be the > way that it's done, on my machine anyway. Perhaps there are programs > that uses these variables on MacOS or Windows? I tried the above on a Trisquel GNU/Windows machine, FWIW. > I'm testing this on the latest Emacs Git version. I can see that > window-adjust-process-window-size-function is used in term.el however, > this doesn't appear to update the environment variables exported to the > terminal process. AFAIR, it's supposed to send the corresponding ioctl command, in addition to setting LINES and COLUMNS. > If I run the same program with term on Emacs git and > resize I get: > > getenv: 31 80 > ioctl: 30 89 > getenv: 31 80 > ioctl: 30 90 > getenv: 31 80 > ioctl: 30 91 > getenv: 31 80 > ioctl: 31 92 > getenv: 31 80 > ioctl: 31 93 > getenv: 31 80 > ioctl: 31 94 > ... > > Notice that the values returned by getenv don't change. Again, the "env | fgrep LINES" method does show the change when I resize the window on the machine I tried this, so I'm unsure why you don't see it. > Given that this functionality is broken, I'm suggesting that we don't > export the variables. I don't agree that it's broken; it isn't for me. I think someone who understands more than I do about this stuff should chime in and explain why we see such different results. From debbugs-submit-bounces@debbugs.gnu.org Tue Oct 01 15:15:13 2019 Received: (at 37564) by debbugs.gnu.org; 1 Oct 2019 19:15:13 +0000 Received: from localhost ([127.0.0.1]:34792 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iFNc9-0003en-DE for submit@debbugs.gnu.org; Tue, 01 Oct 2019 15:15:13 -0400 Received: from eggs.gnu.org ([209.51.188.92]:37562) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iFNc7-0003Xe-RP for 37564@debbugs.gnu.org; Tue, 01 Oct 2019 15:15:12 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:39307) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1iFNc2-0003B8-F8; Tue, 01 Oct 2019 15:15:06 -0400 Received: from [176.228.60.248] (port=4843 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1iFNbz-00041e-6i; Tue, 01 Oct 2019 15:15:05 -0400 Date: Tue, 01 Oct 2019 22:14:38 +0300 Message-Id: <83tv8s8eht.fsf@gnu.org> From: Eli Zaretskii To: matthew@mattleach.net In-reply-to: <83y2y48f8u.fsf@gnu.org> (message from Eli Zaretskii on Tue, 01 Oct 2019 21:58:25 +0300) Subject: Re: bug#37564: [PATCH] don't export LINES and COLUMNS env vars in term to fix ncurses applications References: <87y2y5lfnb.fsf@1e0.co.uk> <83eezxatsv.fsf@gnu.org> <87tv8slb6w.fsf@mattleach.net> <83a7aka1q5.fsf@gnu.org> <87sgocfh8c.fsf@mattleach.net> <83y2y48f8u.fsf@gnu.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 37564 Cc: 37564@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Date: Tue, 01 Oct 2019 21:58:25 +0300 > From: Eli Zaretskii > Cc: 37564@debbugs.gnu.org > > I tried the above on a Trisquel GNU/Windows machine, FWIW. I meant GNU/Linux, of course. Sorry... From debbugs-submit-bounces@debbugs.gnu.org Tue Oct 01 15:24:16 2019 Received: (at 37564) by debbugs.gnu.org; 1 Oct 2019 19:24:17 +0000 Received: from localhost ([127.0.0.1]:34816 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iFNku-0005lP-Gr for submit@debbugs.gnu.org; Tue, 01 Oct 2019 15:24:16 -0400 Received: from mx0.mattleach.net ([176.58.118.143]:53080) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iFNkr-0005lD-KF for 37564@debbugs.gnu.org; Tue, 01 Oct 2019 15:24:15 -0400 Received: by mx0.mattleach.net (Postfix, from userid 99) id 91D9961C91; Tue, 1 Oct 2019 20:24:12 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mx0.mattleach.net X-Spam-Level: X-Spam-Status: No, score=-1.0 required=4.0 tests=ALL_TRUSTED,URIBL_BLOCKED autolearn=disabled version=3.4.2 Received: from hopton.mattleach.net (92.40.249.172.threembb.co.uk [92.40.249.172]) by mx0.mattleach.net (Postfix) with ESMTPSA id A292461C21; Tue, 1 Oct 2019 20:24:11 +0100 (BST) From: Matthew Leach To: Eli Zaretskii Subject: Re: bug#37564: [PATCH] don't export LINES and COLUMNS env vars in term to fix ncurses applications In-Reply-To: <83y2y48f8u.fsf@gnu.org> (Eli Zaretskii's message of "Tue, 01 Oct 2019 21:58:25 +0300") References: <87y2y5lfnb.fsf@1e0.co.uk> <83eezxatsv.fsf@gnu.org> <87tv8slb6w.fsf@mattleach.net> <83a7aka1q5.fsf@gnu.org> <87sgocfh8c.fsf@mattleach.net> <83y2y48f8u.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) Date: Tue, 01 Oct 2019 20:24:14 +0100 Message-ID: <87o8z0few1.fsf@mattleach.net> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 37564 Cc: 37564@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Eli Zaretskii writes: >> From: Matthew Leach >> Cc: 37564@debbugs.gnu.org >> Date: Tue, 01 Oct 2019 19:33:39 +0100 >> >> >> 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. >> > >> > What makes you say that? >> >> If I run the C program in my previous post in an xterm and resize I get: >> >> getenv: (null) (null) >> ioctl: 24 80 >> getenv: (null) (null) >> ioctl: 42 169 >> >> You can see that doing getenv() on LINES and COLUMNS returns a null >> pointer. I've tested this same behaviour on gnome-terminal and numerous >> other terminal emulators. > > I simply tried "env | fgrep LINES" and I do see the variable, although > it wasn't there before I launched Emacs. I would expect the variable to be there when inside Emacs as it has exported it. You should find that it won't exist if ran outside Emacs, for example in xterm. > 'env' is just another program accessing the environment, right? I have > no idea why your test program doesn't see that, but then I'm far from > being an expert on these issues. Indeed, it does see the variables if I run inside Emacs. If I run it outside then they are not there, on my machine anyway. >> > Emacs exports these variables into the environment that is passed to >> > child subprocesses, so those subprocesses will definitely see them >> > using getenv. >> >> I'm no expert on how these things work but it doesn't appear to be the >> way that it's done, on my machine anyway. Perhaps there are programs >> that uses these variables on MacOS or Windows? > > I tried the above on a Trisquel GNU/Windows machine, FWIW. I'm running on Arch GNU/Linux this end. >> I'm testing this on the latest Emacs Git version. I can see that >> window-adjust-process-window-size-function is used in term.el however, >> this doesn't appear to update the environment variables exported to the >> terminal process. > > AFAIR, it's supposed to send the corresponding ioctl command, in > addition to setting LINES and COLUMNS. > >> If I run the same program with term on Emacs git and >> resize I get: >> >> getenv: 31 80 >> ioctl: 30 89 >> getenv: 31 80 >> ioctl: 30 90 >> getenv: 31 80 >> ioctl: 30 91 >> getenv: 31 80 >> ioctl: 31 92 >> getenv: 31 80 >> ioctl: 31 93 >> getenv: 31 80 >> ioctl: 31 94 >> ... >> >> Notice that the values returned by getenv don't change. > > Again, the "env | fgrep LINES" method does show the change when I > resize the window on the machine I tried this, so I'm unsure why you > don't see it. Ah, indeed if I try and resize and print the variable it has updated: matthew@hopton ~ $ env | grep -i lines LINES=30 matthew@hopton ~ $ env | grep -i lines LINES=12 I think the issue is that the environment can't be while a process is running; the environment variables are fixed when the program has started. For a ncurses application this presents a problem as LINES and COLUMNS can't be updated when the window size is changed and the program handles a SIGWINCH. You can see that on the output above. >> Given that this functionality is broken, I'm suggesting that we don't >> export the variables. > > I don't agree that it's broken; it isn't for me. I think someone who > understands more than I do about this stuff should chime in and > explain why we see such different results. I think the above explains what's going on. Perhaps that's why terminal emulators don't export LINES and COLUMNS to programs so an ioctl() is used instead? -- Matt From debbugs-submit-bounces@debbugs.gnu.org Tue Oct 01 22:28:38 2019 Received: (at 37564) by debbugs.gnu.org; 2 Oct 2019 02:28:38 +0000 Received: from localhost ([127.0.0.1]:35266 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iFUNa-0006M8-BQ for submit@debbugs.gnu.org; Tue, 01 Oct 2019 22:28:38 -0400 Received: from eggs.gnu.org ([209.51.188.92]:32851) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iFUNX-0006Lu-Jq for 37564@debbugs.gnu.org; Tue, 01 Oct 2019 22:28:37 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:46504) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1iFUNQ-0001qi-U4; Tue, 01 Oct 2019 22:28:30 -0400 Received: from [176.228.60.248] (port=3350 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1iFUNO-0000i0-HI; Tue, 01 Oct 2019 22:28:28 -0400 Date: Wed, 02 Oct 2019 05:28:15 +0300 Message-Id: <83sgob98zk.fsf@gnu.org> From: Eli Zaretskii To: Matthew Leach In-reply-to: <87o8z0few1.fsf@mattleach.net> (message from Matthew Leach on Tue, 01 Oct 2019 20:24:14 +0100) Subject: Re: bug#37564: [PATCH] don't export LINES and COLUMNS env vars in term to fix ncurses applications References: <87y2y5lfnb.fsf@1e0.co.uk> <83eezxatsv.fsf@gnu.org> <87tv8slb6w.fsf@mattleach.net> <83a7aka1q5.fsf@gnu.org> <87sgocfh8c.fsf@mattleach.net> <83y2y48f8u.fsf@gnu.org> <87o8z0few1.fsf@mattleach.net> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 37564 Cc: 37564@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Matthew Leach > Cc: 37564@debbugs.gnu.org > Date: Tue, 01 Oct 2019 20:24:14 +0100 > > > I simply tried "env | fgrep LINES" and I do see the variable, although > > it wasn't there before I launched Emacs. > > I would expect the variable to be there when inside Emacs as it has > exported it. You should find that it won't exist if ran outside Emacs, > for example in xterm. Sorry, I'm confused. Are we talking about running "M-x term" inside Emacs, or are we talking about something else? The subject of the bug report says "term", so I assumed you mean term-mode. > Ah, indeed if I try and resize and print the variable it has updated: > > matthew@hopton ~ $ env | grep -i lines > LINES=30 > matthew@hopton ~ $ env | grep -i lines > LINES=12 > > I think the issue is that the environment can't be while a process is > running; the environment variables are fixed when the program has > started. For a ncurses application this presents a problem as LINES and > COLUMNS can't be updated when the window size is changed and the program > handles a SIGWINCH. You can see that on the output above. While the process is running, Emacs sends ioctl commands to communicate the window size changes. From debbugs-submit-bounces@debbugs.gnu.org Thu Oct 03 13:51:27 2019 Received: (at 37564) by debbugs.gnu.org; 3 Oct 2019 17:51:27 +0000 Received: from localhost ([127.0.0.1]:41098 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iG5GB-0004Td-2p for submit@debbugs.gnu.org; Thu, 03 Oct 2019 13:51:27 -0400 Received: from eggs.gnu.org ([209.51.188.92]:56749) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iG5G9-0004TQ-1O for 37564@debbugs.gnu.org; Thu, 03 Oct 2019 13:51:25 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:49564) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1iG5G3-0006yc-GD; Thu, 03 Oct 2019 13:51:19 -0400 Received: from rgm by fencepost.gnu.org with local (Exim 4.82) (envelope-from ) id 1iG5G1-0006jC-0o; Thu, 03 Oct 2019 13:51:17 -0400 From: Glenn Morris To: Eli Zaretskii Subject: Re: bug#37564: [PATCH] don't export LINES and COLUMNS env vars in term to fix ncurses applications References: <87y2y5lfnb.fsf@1e0.co.uk> <83eezxatsv.fsf@gnu.org> <87tv8slb6w.fsf@mattleach.net> <83a7aka1q5.fsf@gnu.org> <87sgocfh8c.fsf@mattleach.net> <83y2y48f8u.fsf@gnu.org> <87o8z0few1.fsf@mattleach.net> <83sgob98zk.fsf@gnu.org> X-Spook: Interstate 2600 dedicated denial of service Closure Foot X-Ran: L2}yP(H|HJwj^)]I-X%OGt]r`Es`8o8ZzVMmhm#My (Eli Zaretskii's message of "Wed, 02 Oct 2019 05:28:15 +0300") Message-ID: <9ipnjdemzv.fsf@fencepost.gnu.org> User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) MIME-Version: 1.0 Content-Type: text/plain X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: -1.6 (-) X-Debbugs-Envelope-To: 37564 Cc: Matthew Leach , 37564@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.6 (--) I think the point is that no terminal emulator / shell combination actually exports LINES and COLUMNS as environment variables, except for Emacs term.el. So no application can be relying on the LINES and COLUMNS environment variables (since there aren't any applications specifically for use inside Emacs's term). So term.el should stop setting them, since it actually causes problems. From debbugs-submit-bounces@debbugs.gnu.org Fri Oct 04 14:47:44 2019 Received: (at 37564) by debbugs.gnu.org; 4 Oct 2019 18:47:44 +0000 Received: from localhost ([127.0.0.1]:43464 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iGScC-0007bd-0L for submit@debbugs.gnu.org; Fri, 04 Oct 2019 14:47:44 -0400 Received: from mx0.mattleach.net ([176.58.118.143]:55348) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iGSc9-0007bT-6r for 37564@debbugs.gnu.org; Fri, 04 Oct 2019 14:47:41 -0400 Received: by mx0.mattleach.net (Postfix, from userid 99) id 8AC2161C5D; Fri, 4 Oct 2019 19:47:39 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mx0.mattleach.net X-Spam-Level: X-Spam-Status: No, score=-1.0 required=4.0 tests=ALL_TRUSTED autolearn=disabled version=3.4.2 Received: from hopton.mattleach.net (92.40.249.172.threembb.co.uk [92.40.249.172]) by mx0.mattleach.net (Postfix) with ESMTPSA id A7CC361C21; Fri, 4 Oct 2019 19:47:38 +0100 (BST) From: Matthew Leach To: Eli Zaretskii Subject: Re: bug#37564: [PATCH] don't export LINES and COLUMNS env vars in term to fix ncurses applications In-Reply-To: <83sgob98zk.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 02 Oct 2019 05:28:15 +0300") References: <87y2y5lfnb.fsf@1e0.co.uk> <83eezxatsv.fsf@gnu.org> <87tv8slb6w.fsf@mattleach.net> <83a7aka1q5.fsf@gnu.org> <87sgocfh8c.fsf@mattleach.net> <83y2y48f8u.fsf@gnu.org> <87o8z0few1.fsf@mattleach.net> <83sgob98zk.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) Date: Fri, 04 Oct 2019 19:47:41 +0100 Message-ID: <87d0fcjqk2.fsf@mattleach.net> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 37564 Cc: 37564@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Eli Zaretskii writes: >> From: Matthew Leach >> Cc: 37564@debbugs.gnu.org >> Date: Tue, 01 Oct 2019 20:24:14 +0100 >> >> > I simply tried "env | fgrep LINES" and I do see the variable, although >> > it wasn't there before I launched Emacs. >> >> I would expect the variable to be there when inside Emacs as it has >> exported it. You should find that it won't exist if ran outside Emacs, >> for example in xterm. > > Sorry, I'm confused. Are we talking about running "M-x term" inside > Emacs, or are we talking about something else? The subject of the bug > report says "term", so I assumed you mean term-mode. Indeed, I'm talking about term-mode (M-x term). Sorry if I didn't make that clear. >> Ah, indeed if I try and resize and print the variable it has updated: >> >> matthew@hopton ~ $ env | grep -i lines >> LINES=30 >> matthew@hopton ~ $ env | grep -i lines >> LINES=12 >> >> I think the issue is that the environment can't be while a process is >> running; the environment variables are fixed when the program has >> started. For a ncurses application this presents a problem as LINES and >> COLUMNS can't be updated when the window size is changed and the program >> handles a SIGWINCH. You can see that on the output above. > > While the process is running, Emacs sends ioctl commands to > communicate the window size changes. Sure but by exporting LINES and COLUMNS (something that other terminal emulators don't do) programs aren't picking up changes in the window size. -- Matt From debbugs-submit-bounces@debbugs.gnu.org Fri Oct 04 14:48:50 2019 Received: (at 37564) by debbugs.gnu.org; 4 Oct 2019 18:48:50 +0000 Received: from localhost ([127.0.0.1]:43470 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iGSdG-0007de-Ck for submit@debbugs.gnu.org; Fri, 04 Oct 2019 14:48:50 -0400 Received: from mx0.mattleach.net ([176.58.118.143]:55366) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iGSdE-0007dW-Sm for 37564@debbugs.gnu.org; Fri, 04 Oct 2019 14:48:49 -0400 Received: by mx0.mattleach.net (Postfix, from userid 99) id 6CD0F61C21; Fri, 4 Oct 2019 19:48:48 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mx0.mattleach.net X-Spam-Level: X-Spam-Status: No, score=-1.0 required=4.0 tests=ALL_TRUSTED autolearn=disabled version=3.4.2 Received: from hopton.mattleach.net (92.40.249.172.threembb.co.uk [92.40.249.172]) by mx0.mattleach.net (Postfix) with ESMTPSA id AC41B61C21; Fri, 4 Oct 2019 19:48:45 +0100 (BST) From: Matthew Leach To: Glenn Morris Subject: Re: bug#37564: [PATCH] don't export LINES and COLUMNS env vars in term to fix ncurses applications In-Reply-To: <9ipnjdemzv.fsf@fencepost.gnu.org> (Glenn Morris's message of "Thu, 03 Oct 2019 13:51:16 -0400") References: <87y2y5lfnb.fsf@1e0.co.uk> <83eezxatsv.fsf@gnu.org> <87tv8slb6w.fsf@mattleach.net> <83a7aka1q5.fsf@gnu.org> <87sgocfh8c.fsf@mattleach.net> <83y2y48f8u.fsf@gnu.org> <87o8z0few1.fsf@mattleach.net> <83sgob98zk.fsf@gnu.org> <9ipnjdemzv.fsf@fencepost.gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) Date: Fri, 04 Oct 2019 19:48:49 +0100 Message-ID: <878sq0jqi6.fsf@mattleach.net> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 37564 Cc: Eli Zaretskii , 37564@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Glenn Morris writes: > I think the point is that no terminal emulator / shell combination > actually exports LINES and COLUMNS as environment variables, except for > Emacs term.el. So no application can be relying on the LINES and COLUMNS > environment variables (since there aren't any applications specifically > for use inside Emacs's term). So term.el should stop setting them, since > it actually causes problems. Exactly that. By exporting these variables it's causing more problems than it solves. -- Matt From debbugs-submit-bounces@debbugs.gnu.org Mon Oct 07 00:11:41 2019 Received: (at 37564) by debbugs.gnu.org; 7 Oct 2019 04:11:41 +0000 Received: from localhost ([127.0.0.1]:47155 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iHKN3-00042O-AZ for submit@debbugs.gnu.org; Mon, 07 Oct 2019 00:11:41 -0400 Received: from quimby.gnus.org ([80.91.231.51]:55586) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iHKN1-00042E-3b for 37564@debbugs.gnu.org; Mon, 07 Oct 2019 00:11:40 -0400 Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=marnie) by quimby.gnus.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1iHKMx-0005V0-D6; Mon, 07 Oct 2019 06:11:37 +0200 From: Lars Ingebrigtsen To: Matthew Leach Subject: Re: bug#37564: [PATCH] don't export LINES and COLUMNS env vars in term to fix ncurses applications References: <87y2y5lfnb.fsf@1e0.co.uk> <83eezxatsv.fsf@gnu.org> <87tv8slb6w.fsf@mattleach.net> <83a7aka1q5.fsf@gnu.org> <87sgocfh8c.fsf@mattleach.net> <83y2y48f8u.fsf@gnu.org> <87o8z0few1.fsf@mattleach.net> Date: Mon, 07 Oct 2019 06:11:35 +0200 In-Reply-To: <87o8z0few1.fsf@mattleach.net> (Matthew Leach's message of "Tue, 01 Oct 2019 20:24:14 +0100") Message-ID: <87sgo59oug.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Matthew Leach writes: >> I simply tried "env | fgrep LINES" and I do see the variable, although >> it wasn't there before I launched Emacs. > > I would expect the variable to be there when inside Emacs as it has > exported [...] Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 37564 Cc: Eli Zaretskii , 37564@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Matthew Leach writes: >> I simply tried "env | fgrep LINES" and I do see the variable, although >> it wasn't there before I launched Emacs. > > I would expect the variable to be there when inside Emacs as it has > exported it. You should find that it won't exist if ran outside Emacs, > for example in xterm. I tried this in my bash here (under the "Terminal" program in Debian): larsi@marnie:~/src/emacs/trunk$ set | grep LINES LINES=24 larsi@marnie:~/src/emacs/trunk$ set | grep COLUMNS COLUMNS=80 So they're in my env at least. But I see I have this in my very ancient ~/.bashrc: # check the window size after each command and, if necessary, # update the values of LINES and COLUMNS. shopt -s checkwinsize -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From debbugs-submit-bounces@debbugs.gnu.org Mon Oct 07 05:16:33 2019 Received: (at 37564) by debbugs.gnu.org; 7 Oct 2019 09:16:33 +0000 Received: from localhost ([127.0.0.1]:47366 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iHP84-0000pl-QP for submit@debbugs.gnu.org; Mon, 07 Oct 2019 05:16:33 -0400 Received: from mail-out.m-online.net ([212.18.0.9]:46747) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iHP81-0000pb-5N for 37564@debbugs.gnu.org; Mon, 07 Oct 2019 05:16:31 -0400 Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 46mvx8030Tz1rKJk; Mon, 7 Oct 2019 11:16:27 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 46mvx75Qnmz1qqkC; Mon, 7 Oct 2019 11:16:27 +0200 (CEST) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id 4sNlZhyFVHbw; Mon, 7 Oct 2019 11:16:27 +0200 (CEST) X-Auth-Info: TpsNO53QkHkWaC84RHJ9cJe5ljNgJdciMOFyMzNyAEqPbxcjbsV8dzKmlMr3czMW Received: from igel.home (ppp-46-244-165-160.dynamic.mnet-online.de [46.244.165.160]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA; Mon, 7 Oct 2019 11:16:26 +0200 (CEST) Received: by igel.home (Postfix, from userid 1000) id 420FB2C0181; Mon, 7 Oct 2019 11:16:26 +0200 (CEST) From: Andreas Schwab To: Lars Ingebrigtsen Subject: Re: bug#37564: [PATCH] don't export LINES and COLUMNS env vars in term to fix ncurses applications References: <87y2y5lfnb.fsf@1e0.co.uk> <83eezxatsv.fsf@gnu.org> <87tv8slb6w.fsf@mattleach.net> <83a7aka1q5.fsf@gnu.org> <87sgocfh8c.fsf@mattleach.net> <83y2y48f8u.fsf@gnu.org> <87o8z0few1.fsf@mattleach.net> <87sgo59oug.fsf@gnus.org> X-Yow: I'm GLAD I remembered to XEROX all my UNDERSHIRTS!! Date: Mon, 07 Oct 2019 11:16:26 +0200 In-Reply-To: <87sgo59oug.fsf@gnus.org> (Lars Ingebrigtsen's message of "Mon, 07 Oct 2019 06:11:35 +0200") Message-ID: <878spw3ogl.fsf@igel.home> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.5 (/) X-Debbugs-Envelope-To: 37564 Cc: Matthew Leach , 37564@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.5 (-) On Okt 07 2019, Lars Ingebrigtsen wrote: > I tried this in my bash here (under the "Terminal" program in Debian): > > larsi@marnie:~/src/emacs/trunk$ set | grep LINES > LINES=24 > larsi@marnie:~/src/emacs/trunk$ set | grep COLUMNS > COLUMNS=80 > > So they're in my env at least. `set' doesn't print the environment, it prints the shell variables. To print the environment, use `export -p' or `printenv'. Andreas. -- Andreas Schwab, schwab@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1 "And now for something completely different." From debbugs-submit-bounces@debbugs.gnu.org Tue Oct 08 12:38:39 2019 Received: (at 37564) by debbugs.gnu.org; 8 Oct 2019 16:38:39 +0000 Received: from localhost ([127.0.0.1]:51352 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iHsVT-00071b-0g for submit@debbugs.gnu.org; Tue, 08 Oct 2019 12:38:39 -0400 Received: from quimby.gnus.org ([80.91.231.51]:39682) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iHsVQ-00071R-G8 for 37564@debbugs.gnu.org; Tue, 08 Oct 2019 12:38:37 -0400 Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=marnie) by quimby.gnus.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1iHsVM-0007Rw-Jp; Tue, 08 Oct 2019 18:38:35 +0200 From: Lars Ingebrigtsen To: Andreas Schwab Subject: Re: bug#37564: [PATCH] don't export LINES and COLUMNS env vars in term to fix ncurses applications References: <87y2y5lfnb.fsf@1e0.co.uk> <83eezxatsv.fsf@gnu.org> <87tv8slb6w.fsf@mattleach.net> <83a7aka1q5.fsf@gnu.org> <87sgocfh8c.fsf@mattleach.net> <83y2y48f8u.fsf@gnu.org> <87o8z0few1.fsf@mattleach.net> <87sgo59oug.fsf@gnus.org> <878spw3ogl.fsf@igel.home> Date: Tue, 08 Oct 2019 18:38:32 +0200 In-Reply-To: <878spw3ogl.fsf@igel.home> (Andreas Schwab's message of "Mon, 07 Oct 2019 11:16:26 +0200") Message-ID: <87muebyyyf.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Andreas Schwab writes: > `set' doesn't print the environment, it prints the shell variables. To > print the environment, use `export -p' or `printenv'. I see. Yes, they are not in my environment when I check with printenv. Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 37564 Cc: Matthew Leach , 37564@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Andreas Schwab writes: > `set' doesn't print the environment, it prints the shell variables. To > print the environment, use `export -p' or `printenv'. I see. Yes, they are not in my environment when I check with printenv. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From debbugs-submit-bounces@debbugs.gnu.org Mon Jan 20 14:11:02 2020 Received: (at 37564) by debbugs.gnu.org; 20 Jan 2020 19:11:02 +0000 Received: from localhost ([127.0.0.1]:46062 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1itcRx-000735-T5 for submit@debbugs.gnu.org; Mon, 20 Jan 2020 14:11:02 -0500 Received: from ted.gofardesign.uk ([67.225.143.91]:36498) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1itcRt-00072e-I7 for 37564@debbugs.gnu.org; Mon, 20 Jan 2020 14:10:59 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=marxist.se; s=default; h=Content-Type:MIME-Version:Message-ID:Date:References: In-Reply-To:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=SpXISppEEQ0hycvsYohQ5UbmnpaSqKq3Z35AAPD8JwI=; b=FxQ8/CygNmtgVs2Crob666rGpe 5WZlQvAAGZF0NQ8uREIiy08N/bJTjDCiE0rrq0VBTMlpHrXBytbzO6Y56nvzK3jH26XFFX61ACdRA 1rkEzFFVqO6Ks/ji+cSYOzAt6qO4EJcPTZ/VYVkhWe0WN8KKAdPBEBmX/+JCmc0MY0iMPIGosISoF pm5Wqg7132gmhUu7v6nodGLoAqFZ4078jw/fmTK0aDXccbsSuj8lLrP7WZJiEDu6A42CYz51jMLwK qfBTHksf2IH8nWdNdO8VQLzs5rR8YQfHLqj5rj6/f21hXbOzsdilmoqmAs3g71A3iDdjjbDUfs43t FqYASjmA==; Received: from h-70-69.a785.priv.bahnhof.se ([155.4.70.69]:45242 helo=localhost) by ted.gofardesign.uk with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92) (envelope-from ) id 1itcRm-001rAC-DJ; Mon, 20 Jan 2020 14:10:50 -0500 From: Stefan Kangas To: Matthew Leach Subject: Re: bug#37564: [PATCH] don't export LINES and COLUMNS env vars in term to fix ncurses applications In-Reply-To: <878sq0jqi6.fsf@mattleach.net> (Matthew Leach's message of "Fri, 04 Oct 2019 19:48:49 +0100") References: <87y2y5lfnb.fsf@1e0.co.uk> <83eezxatsv.fsf@gnu.org> <87tv8slb6w.fsf@mattleach.net> <83a7aka1q5.fsf@gnu.org> <87sgocfh8c.fsf@mattleach.net> <83y2y48f8u.fsf@gnu.org> <87o8z0few1.fsf@mattleach.net> <83sgob98zk.fsf@gnu.org> <9ipnjdemzv.fsf@fencepost.gnu.org> <878sq0jqi6.fsf@mattleach.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Date: Mon, 20 Jan 2020 20:10:49 +0100 Message-ID: <87o8uyrlja.fsf@marxist.se> MIME-Version: 1.0 Content-Type: text/plain X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - ted.gofardesign.uk X-AntiAbuse: Original Domain - debbugs.gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - marxist.se X-Get-Message-Sender-Via: ted.gofardesign.uk: authenticated_id: stefan@marxist.se X-Authenticated-Sender: ted.gofardesign.uk: stefan@marxist.se X-Source: X-Source-Args: X-Source-Dir: X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 37564 Cc: Glenn Morris , Eli Zaretskii , 37564@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Matthew Leach writes: > Glenn Morris writes: > >> I think the point is that no terminal emulator / shell combination >> actually exports LINES and COLUMNS as environment variables, except for >> Emacs term.el. So no application can be relying on the LINES and COLUMNS >> environment variables (since there aren't any applications specifically >> for use inside Emacs's term). So term.el should stop setting them, since >> it actually causes problems. > > Exactly that. By exporting these variables it's causing more problems > than it solves. That sounds reasonable to me. Should we go ahead and install the original patch on the master branch then, or is there more to discuss? Best regards, Stefan Kangas From debbugs-submit-bounces@debbugs.gnu.org Mon Jan 20 14:30:38 2020 Received: (at 37564) by debbugs.gnu.org; 20 Jan 2020 19:30:38 +0000 Received: from localhost ([127.0.0.1]:46075 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1itckt-0007Xu-Aq for submit@debbugs.gnu.org; Mon, 20 Jan 2020 14:30:38 -0500 Received: from eggs.gnu.org ([209.51.188.92]:55632) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1itcko-0007Xb-54 for 37564@debbugs.gnu.org; Mon, 20 Jan 2020 14:30:33 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]:59381) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1itcki-0001Fn-Jo; Mon, 20 Jan 2020 14:30:24 -0500 Received: from [176.228.60.248] (port=4398 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1itckf-00052l-0L; Mon, 20 Jan 2020 14:30:22 -0500 Date: Mon, 20 Jan 2020 21:30:28 +0200 Message-Id: <83pnfevsbv.fsf@gnu.org> From: Eli Zaretskii To: Stefan Kangas In-reply-to: <87o8uyrlja.fsf@marxist.se> (message from Stefan Kangas on Mon, 20 Jan 2020 20:10:49 +0100) Subject: Re: bug#37564: [PATCH] don't export LINES and COLUMNS env vars in term to fix ncurses applications References: <87y2y5lfnb.fsf@1e0.co.uk> <83eezxatsv.fsf@gnu.org> <87tv8slb6w.fsf@mattleach.net> <83a7aka1q5.fsf@gnu.org> <87sgocfh8c.fsf@mattleach.net> <83y2y48f8u.fsf@gnu.org> <87o8z0few1.fsf@mattleach.net> <83sgob98zk.fsf@gnu.org> <9ipnjdemzv.fsf@fencepost.gnu.org> <878sq0jqi6.fsf@mattleach.net> <87o8uyrlja.fsf@marxist.se> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 37564 Cc: matthew@mattleach.net, 37564@debbugs.gnu.org, rgm@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Stefan Kangas > Cc: Glenn Morris , Eli Zaretskii , > 37564@debbugs.gnu.org > Date: Mon, 20 Jan 2020 20:10:49 +0100 > > Matthew Leach writes: > > > Glenn Morris writes: > > > >> I think the point is that no terminal emulator / shell combination > >> actually exports LINES and COLUMNS as environment variables, except for > >> Emacs term.el. So no application can be relying on the LINES and COLUMNS > >> environment variables (since there aren't any applications specifically > >> for use inside Emacs's term). So term.el should stop setting them, since > >> it actually causes problems. > > > > Exactly that. By exporting these variables it's causing more problems > > than it solves. > > That sounds reasonable to me. Should we go ahead and install the > original patch on the master branch then, or is there more to discuss? Sorry, but I need more than just assertions to convince me. I have yet to see an application that doesn't cater to LINES and COLUMNS. Heck, Emacs itself does! It is true that these variables nowadays are mostly kept for the users, but that doesn't yet mean Emacs cannot use them to affect the programs it runs. As for "causing more problems than it solves", I don't think I saw any evidence for that: even the one use case which started this bug report was later shown to behave as expected. Or maybe I was just confused, in which case I'd appreciate a clear and concise description of how these variables are harmful for ncurses programs. From debbugs-submit-bounces@debbugs.gnu.org Mon Jan 20 19:59:05 2020 Received: (at 37564) by debbugs.gnu.org; 21 Jan 2020 00:59:05 +0000 Received: from localhost ([127.0.0.1]:46314 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ithsm-0002Xq-VD for submit@debbugs.gnu.org; Mon, 20 Jan 2020 19:59:05 -0500 Received: from eggs.gnu.org ([209.51.188.92]:60232) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ithsl-0002XF-Pb for 37564@debbugs.gnu.org; Mon, 20 Jan 2020 19:59:04 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]:35658) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ithsg-00035C-8j; Mon, 20 Jan 2020 19:58:58 -0500 Received: from rgm by fencepost.gnu.org with local (Exim 4.82) (envelope-from ) id 1ithsc-0007ce-BW; Mon, 20 Jan 2020 19:58:54 -0500 From: Glenn Morris To: Eli Zaretskii Subject: Re: bug#37564: [PATCH] don't export LINES and COLUMNS env vars in term to fix ncurses applications References: <87y2y5lfnb.fsf@1e0.co.uk> <83eezxatsv.fsf@gnu.org> <87tv8slb6w.fsf@mattleach.net> <83a7aka1q5.fsf@gnu.org> <87sgocfh8c.fsf@mattleach.net> <83y2y48f8u.fsf@gnu.org> <87o8z0few1.fsf@mattleach.net> <83sgob98zk.fsf@gnu.org> <9ipnjdemzv.fsf@fencepost.gnu.org> <878sq0jqi6.fsf@mattleach.net> <87o8uyrlja.fsf@marxist.se> <83pnfevsbv.fsf@gnu.org> X-Spook: CipherTAC-2000 Mexico Agriculture enemy of the state X-Ran: 'q~,.wQ`V#*`XGjw7K?:FhIGAKb04-qFm`g8u%O>3"=EM@:`lac,b|LFizAW?x+/QH0)S| X-Hue: brightred X-Debbugs-No-Ack: yes X-Attribution: GM Date: Mon, 20 Jan 2020 19:58:53 -0500 In-Reply-To: <83pnfevsbv.fsf@gnu.org> (Eli Zaretskii's message of "Mon, 20 Jan 2020 21:30:28 +0200") Message-ID: <7nd0bd8w1e.fsf@fencepost.gnu.org> User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) MIME-Version: 1.0 Content-Type: text/plain X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 37564 Cc: matthew@mattleach.net, 37564@debbugs.gnu.org, Stefan Kangas X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) The report seems clear to me. No other terminal emulator exports LINES and COLUMNS as environment variables. Applications use ioctl to get the size. -> Therefore setting LINES and COLUMNS is pointless. If LINES/COLUMNS are set, they override ioctl. You can't update the environment of an already running process. Therefore the presence of LINES/COLUMNS in the initial environment of a process spawned from Emacs means it will fail to react to resizing. Therefore exporting LINES and COLUMNS is harmful. (It's irrelevant if Emacs changes LINES and COLUMNS for new processes.) So don't export LINES and COLUMNS. I can't explain it any better. From debbugs-submit-bounces@debbugs.gnu.org Mon Jan 20 22:04:30 2020 Received: (at 37564) by debbugs.gnu.org; 21 Jan 2020 03:04:30 +0000 Received: from localhost ([127.0.0.1]:46354 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1itjq9-00018a-S3 for submit@debbugs.gnu.org; Mon, 20 Jan 2020 22:04:30 -0500 Received: from ted.gofardesign.uk ([67.225.143.91]:46252) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1itjq8-00018O-DK for 37564@debbugs.gnu.org; Mon, 20 Jan 2020 22:04:28 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=marxist.se; s=default; h=Content-Type:MIME-Version:Message-ID:Date:References: In-Reply-To:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=Zyosv99KXBj/Hm4WLSYvEgJuKT6VMGjmd/BN+c0GcuQ=; b=msiPJwzXVSQ1eJN4O9bj7H+z5w iCgLtjmyiUkY2L22OzTUhTxthLWJi12PSe6qeohjVWj/2HowwsnyIF1ZIUsTpXfSxLgRAougZlu2k ZLQTPzxiN1WZN7Mcfii/9KuvEsaK1ie2TUl7hSMSVycoA18xcgQPp+oKYikyla4yKfqg4t3Fysw3e o/k1oauGzBX4qnjfIcdxT1LbCuiwv4dUXiEI9IaW54iuD9IZdEGI6VS53BWYIfSB8na4P+EvPp86+ uZ8AoGvao9lSSVpZ7haPXJ3zN6U/AKGCGgqylIwugjZ3yumAlOmHeWOycV2ijoUIo72jiBV5WuGBI Sg/FycRA==; Received: from h-70-69.a785.priv.bahnhof.se ([155.4.70.69]:44952 helo=localhost) by ted.gofardesign.uk with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92) (envelope-from ) id 1itjq0-001YPx-N9; Mon, 20 Jan 2020 22:04:20 -0500 From: Stefan Kangas To: Eli Zaretskii Subject: Re: bug#37564: [PATCH] don't export LINES and COLUMNS env vars in term to fix ncurses applications In-Reply-To: <83pnfevsbv.fsf@gnu.org> (Eli Zaretskii's message of "Mon, 20 Jan 2020 21:30:28 +0200") References: <87y2y5lfnb.fsf@1e0.co.uk> <83eezxatsv.fsf@gnu.org> <87tv8slb6w.fsf@mattleach.net> <83a7aka1q5.fsf@gnu.org> <87sgocfh8c.fsf@mattleach.net> <83y2y48f8u.fsf@gnu.org> <87o8z0few1.fsf@mattleach.net> <83sgob98zk.fsf@gnu.org> <9ipnjdemzv.fsf@fencepost.gnu.org> <878sq0jqi6.fsf@mattleach.net> <87o8uyrlja.fsf@marxist.se> <83pnfevsbv.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Date: Tue, 21 Jan 2020 04:04:18 +0100 Message-ID: <87muahmrwt.fsf@marxist.se> MIME-Version: 1.0 Content-Type: text/plain X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - ted.gofardesign.uk X-AntiAbuse: Original Domain - debbugs.gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - marxist.se X-Get-Message-Sender-Via: ted.gofardesign.uk: authenticated_id: stefan@marxist.se X-Authenticated-Sender: ted.gofardesign.uk: stefan@marxist.se X-Source: X-Source-Args: X-Source-Dir: X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 37564 Cc: matthew@mattleach.net, 37564@debbugs.gnu.org, rgm@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Eli Zaretskii writes: > As for "causing more problems than it solves", I don't think I saw > any evidence for that: even the one use case which started this bug > report was later shown to behave as expected. The recipe in the OP was: > emacs -Q > M-x term > (to select /bin/bash) > htop (to run htop) > > and resizing the window (especially making it smaller) can make the > program impossible to read. When I do this on my machine, the output gets all messed up and impossible to read. Best regards, Stefan Kangas From debbugs-submit-bounces@debbugs.gnu.org Tue Jan 21 12:11:31 2020 Received: (at 37564) by debbugs.gnu.org; 21 Jan 2020 17:11:31 +0000 Received: from localhost ([127.0.0.1]:48377 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1itx3o-0007F4-2G for submit@debbugs.gnu.org; Tue, 21 Jan 2020 12:11:31 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35397) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1itx3j-0007Ej-MP for 37564@debbugs.gnu.org; Tue, 21 Jan 2020 12:11:27 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]:49758) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1itx3d-0005EM-LD; Tue, 21 Jan 2020 12:11:17 -0500 Received: from [176.228.60.248] (port=3629 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1itx3c-0003lI-E3; Tue, 21 Jan 2020 12:11:16 -0500 Date: Tue, 21 Jan 2020 19:11:26 +0200 Message-Id: <83y2u0vio1.fsf@gnu.org> From: Eli Zaretskii To: Glenn Morris In-reply-to: <7nd0bd8w1e.fsf@fencepost.gnu.org> (message from Glenn Morris on Mon, 20 Jan 2020 19:58:53 -0500) Subject: Re: bug#37564: [PATCH] don't export LINES and COLUMNS env vars in term to fix ncurses applications References: <87y2y5lfnb.fsf@1e0.co.uk> <83eezxatsv.fsf@gnu.org> <87tv8slb6w.fsf@mattleach.net> <83a7aka1q5.fsf@gnu.org> <87sgocfh8c.fsf@mattleach.net> <83y2y48f8u.fsf@gnu.org> <87o8z0few1.fsf@mattleach.net> <83sgob98zk.fsf@gnu.org> <9ipnjdemzv.fsf@fencepost.gnu.org> <878sq0jqi6.fsf@mattleach.net> <87o8uyrlja.fsf@marxist.se> <83pnfevsbv.fsf@gnu.org> <7nd0bd8w1e.fsf@fencepost.gnu.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 37564 Cc: matthew@mattleach.net, 37564@debbugs.gnu.org, stefan@marxist.se X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Glenn Morris > Cc: Stefan Kangas , matthew@mattleach.net, 37564@debbugs.gnu.org > Date: Mon, 20 Jan 2020 19:58:53 -0500 > > > No other terminal emulator exports LINES and COLUMNS as environment variables. Maybe so, but that in itself doesn't yet mean Emacs cannot do that, if we decide it's useful. > Applications use ioctl to get the size. > -> Therefore setting LINES and COLUMNS is pointless. > If LINES/COLUMNS are set, they override ioctl. Is the last bit a generally accepted paradigm? I could easily justify the contrary preference. And then there might be applications that don't use ioctl. > You can't update the environment of an already running process. > Therefore the presence of LINES/COLUMNS in the initial environment > of a process spawned from Emacs means it will fail to react to resizing. > Therefore exporting LINES and COLUMNS is harmful. Only if the application uses the variables in preference to ioctl. > So don't export LINES and COLUMNS. I agreed at the very beginning of the discussion to make the export optional. I don't think we can safely remove that unconditionally, not yet. From debbugs-submit-bounces@debbugs.gnu.org Tue Jan 21 13:10:53 2020 Received: (at 37564) by debbugs.gnu.org; 21 Jan 2020 18:10:53 +0000 Received: from localhost ([127.0.0.1]:48447 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1itxzG-0002LI-17 for submit@debbugs.gnu.org; Tue, 21 Jan 2020 13:10:53 -0500 Received: from mx0.mattleach.net ([176.58.118.143]:55710) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1itxzB-0002L7-OQ for 37564@debbugs.gnu.org; Tue, 21 Jan 2020 13:10:49 -0500 Received: by mx0.mattleach.net (Postfix, from userid 99) id 2BD2D61DE6; Tue, 21 Jan 2020 18:10:45 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mx0.mattleach.net X-Spam-Level: X-Spam-Status: No, score=-1.0 required=4.0 tests=ALL_TRUSTED,URIBL_BLOCKED autolearn=disabled version=3.4.2 Received: from troi.mattleach.net (94.197.121.93.threembb.co.uk [94.197.121.93]) by mx0.mattleach.net (Postfix) with ESMTPSA id 65E2C61C21; Tue, 21 Jan 2020 18:10:43 +0000 (GMT) From: Matthew Leach To: Eli Zaretskii Subject: Re: bug#37564: [PATCH] don't export LINES and COLUMNS env vars in term to fix ncurses applications In-Reply-To: <83y2u0vio1.fsf@gnu.org> (Eli Zaretskii's message of "Tue, 21 Jan 2020 19:11:26 +0200") References: <87y2y5lfnb.fsf@1e0.co.uk> <83eezxatsv.fsf@gnu.org> <87tv8slb6w.fsf@mattleach.net> <83a7aka1q5.fsf@gnu.org> <87sgocfh8c.fsf@mattleach.net> <83y2y48f8u.fsf@gnu.org> <87o8z0few1.fsf@mattleach.net> <83sgob98zk.fsf@gnu.org> <9ipnjdemzv.fsf@fencepost.gnu.org> <878sq0jqi6.fsf@mattleach.net> <87o8uyrlja.fsf@marxist.se> <83pnfevsbv.fsf@gnu.org> <7nd0bd8w1e.fsf@fencepost.gnu.org> <83y2u0vio1.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) Date: Tue, 21 Jan 2020 18:10:45 +0000 Message-ID: <87y2u0d6je.fsf@mattleach.net> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 37564 Cc: Glenn Morris , 37564@debbugs.gnu.org, stefan@marxist.se X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Eli Zaretskii writes: >> Applications use ioctl to get the size. >> -> Therefore setting LINES and COLUMNS is pointless. >> If LINES/COLUMNS are set, they override ioctl. > > Is the last bit a generally accepted paradigm? I believe so, yes. At least, that is the case with ncurses. -- Matt From debbugs-submit-bounces@debbugs.gnu.org Tue Jan 21 22:38:22 2020 Received: (at 37564) by debbugs.gnu.org; 22 Jan 2020 03:38:22 +0000 Received: from localhost ([127.0.0.1]:48838 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iu6qU-0007Wa-24 for submit@debbugs.gnu.org; Tue, 21 Jan 2020 22:38:22 -0500 Received: from eggs.gnu.org ([209.51.188.92]:40806) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iu6qS-0007WN-ON for 37564@debbugs.gnu.org; Tue, 21 Jan 2020 22:38:21 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]:59211) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1iu6qM-0002L1-GT; Tue, 21 Jan 2020 22:38:14 -0500 Received: from rgm by fencepost.gnu.org with local (Exim 4.82) (envelope-from ) id 1iu6qI-0007KS-R2; Tue, 21 Jan 2020 22:38:11 -0500 From: Glenn Morris To: Eli Zaretskii Subject: Re: bug#37564: [PATCH] don't export LINES and COLUMNS env vars in term to fix ncurses applications References: <87y2y5lfnb.fsf@1e0.co.uk> <83eezxatsv.fsf@gnu.org> <87tv8slb6w.fsf@mattleach.net> <83a7aka1q5.fsf@gnu.org> <87sgocfh8c.fsf@mattleach.net> <83y2y48f8u.fsf@gnu.org> <87o8z0few1.fsf@mattleach.net> <83sgob98zk.fsf@gnu.org> <9ipnjdemzv.fsf@fencepost.gnu.org> <878sq0jqi6.fsf@mattleach.net> <87o8uyrlja.fsf@marxist.se> <83pnfevsbv.fsf@gnu.org> <7nd0bd8w1e.fsf@fencepost.gnu.org> X-Spook: Cyber Command Ft. Bragg FDA SP4 Pork Plame outage Bin X-Ran: ?.eWok<;4mbn1o9j (Glenn Morris's message of "Mon, 20 Jan 2020 19:58:53 -0500") Message-ID: User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) MIME-Version: 1.0 Content-Type: text/plain X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 37564 Cc: matthew@mattleach.net, 37564@debbugs.gnu.org, Stefan Kangas X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) PS for an example of the effect, one can use some of the programs in the ncurses-examples from https://invisible-island.net/ncurses/ncurses-examples.html eg "worm". If I run it in an xfce4-terminal, then maximise the terminal, the worms spread over the whole screen. If I "export LINES" and COLUMNS beforehand, then the worms don't expand beyond the original terminal size. The same effect is visible in Emacs's M-x term with and without the LINES/COLUMNS variables. From debbugs-submit-bounces@debbugs.gnu.org Wed Jan 22 10:46:43 2020 Received: (at 37564) by debbugs.gnu.org; 22 Jan 2020 15:46:43 +0000 Received: from localhost ([127.0.0.1]:51149 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iuIDK-000276-OE for submit@debbugs.gnu.org; Wed, 22 Jan 2020 10:46:43 -0500 Received: from eggs.gnu.org ([209.51.188.92]:59670) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iuIDI-00026p-Fv for 37564@debbugs.gnu.org; Wed, 22 Jan 2020 10:46:41 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]:39104) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1iuIDD-0005Ja-4W; Wed, 22 Jan 2020 10:46:35 -0500 Received: from [176.228.60.248] (port=2435 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1iuIDB-0000VT-48; Wed, 22 Jan 2020 10:46:33 -0500 Date: Wed, 22 Jan 2020 17:46:47 +0200 Message-Id: <83eevrv6hk.fsf@gnu.org> From: Eli Zaretskii To: Glenn Morris In-reply-to: (message from Glenn Morris on Tue, 21 Jan 2020 22:38:10 -0500) Subject: Re: bug#37564: [PATCH] don't export LINES and COLUMNS env vars in term to fix ncurses applications References: <87y2y5lfnb.fsf@1e0.co.uk> <83eezxatsv.fsf@gnu.org> <87tv8slb6w.fsf@mattleach.net> <83a7aka1q5.fsf@gnu.org> <87sgocfh8c.fsf@mattleach.net> <83y2y48f8u.fsf@gnu.org> <87o8z0few1.fsf@mattleach.net> <83sgob98zk.fsf@gnu.org> <9ipnjdemzv.fsf@fencepost.gnu.org> <878sq0jqi6.fsf@mattleach.net> <87o8uyrlja.fsf@marxist.se> <83pnfevsbv.fsf@gnu.org> <7nd0bd8w1e.fsf@fencepost.gnu.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 37564 Cc: matthew@mattleach.net, 37564@debbugs.gnu.org, stefan@marxist.se X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Glenn Morris > Cc: Stefan Kangas , matthew@mattleach.net, 37564@debbugs.gnu.org > Date: Tue, 21 Jan 2020 22:38:10 -0500 > > > PS for an example of the effect, one can use some of the programs in > the ncurses-examples from > https://invisible-island.net/ncurses/ncurses-examples.html > > eg "worm". I understand that applications based on ncurses are affected, but what about those which aren't based on ncurses? From debbugs-submit-bounces@debbugs.gnu.org Fri Jan 24 13:08:45 2020 Received: (at 37564) by debbugs.gnu.org; 24 Jan 2020 18:08:46 +0000 Received: from localhost ([127.0.0.1]:54731 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iv3Nt-0005X4-Kd for submit@debbugs.gnu.org; Fri, 24 Jan 2020 13:08:45 -0500 Received: from ted.gofardesign.uk ([67.225.143.91]:44956) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iv3Ns-0005Wq-5f for 37564@debbugs.gnu.org; Fri, 24 Jan 2020 13:08:44 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=marxist.se; s=default; h=Content-Type:MIME-Version:Message-ID:Date:References: In-Reply-To:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=VAzTuHelfFaVgmC7M+k2ujWBhWAr6o871G+1eOKX1qc=; b=OPDWxmDUnSrZeSQU07JpKaCS/0 dGBJtxdW5eNDAwa4SoFK5GQFzeMXgE29zkoM/R+lSziW7km43QlHdWmDwxG2waHps3gNdJbBFHtR1 JIQckfETu9h6t3NGIZPWq05dQB3A5s3kQZMgc3DyFoOlG8BzKU5goH8j5jK44DcgDHca+dtZllBbd O48Hf2IYf4AZwVK3QyC7T7gWk2RvaHSbUzRD+6fyVqC7FtuPpKhkm8LWCxsV6qItkI7BCNWIny/6i qPp+M5ONH6C1ZE6Zgo7nJYoWdQdbS2sXKKlGXTTMuZpNe4GOMuIKyYR431x8fE5oZMfuJfKTKC5AO m9Y5jcbA==; Received: from h-70-69.a785.priv.bahnhof.se ([155.4.70.69]:51612 helo=localhost) by ted.gofardesign.uk with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92) (envelope-from ) id 1iv3Nj-001NbU-33; Fri, 24 Jan 2020 13:08:35 -0500 From: Stefan Kangas To: Glenn Morris Subject: Re: bug#37564: [PATCH] don't export LINES and COLUMNS env vars in term to fix ncurses applications In-Reply-To: (Glenn Morris's message of "Tue, 21 Jan 2020 22:38:10 -0500") References: <87y2y5lfnb.fsf@1e0.co.uk> <83eezxatsv.fsf@gnu.org> <87tv8slb6w.fsf@mattleach.net> <83a7aka1q5.fsf@gnu.org> <87sgocfh8c.fsf@mattleach.net> <83y2y48f8u.fsf@gnu.org> <87o8z0few1.fsf@mattleach.net> <83sgob98zk.fsf@gnu.org> <9ipnjdemzv.fsf@fencepost.gnu.org> <878sq0jqi6.fsf@mattleach.net> <87o8uyrlja.fsf@marxist.se> <83pnfevsbv.fsf@gnu.org> <7nd0bd8w1e.fsf@fencepost.gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Date: Fri, 24 Jan 2020 19:08:32 +0100 Message-ID: <87muac917j.fsf@marxist.se> MIME-Version: 1.0 Content-Type: text/plain X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - ted.gofardesign.uk X-AntiAbuse: Original Domain - debbugs.gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - marxist.se X-Get-Message-Sender-Via: ted.gofardesign.uk: authenticated_id: stefan@marxist.se X-Authenticated-Sender: ted.gofardesign.uk: stefan@marxist.se X-Source: X-Source-Args: X-Source-Dir: X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 37564 Cc: matthew@mattleach.net, Eli Zaretskii , 37564@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Glenn Morris writes: > PS for an example of the effect, one can use some of the programs in > the ncurses-examples from > https://invisible-island.net/ncurses/ncurses-examples.html > > eg "worm". > > If I run it in an xfce4-terminal, then maximise the terminal, the worms > spread over the whole screen. > If I "export LINES" and COLUMNS beforehand, then the worms don't expand > beyond the original terminal size. > > The same effect is visible in Emacs's M-x term with and without the > LINES/COLUMNS variables. BTW, we also have Bug#11432. Not sure if that should be merged with this one. Best regards, Stefan Kangas From debbugs-submit-bounces@debbugs.gnu.org Thu Jun 04 12:02:15 2020 Received: (at 37564) by debbugs.gnu.org; 4 Jun 2020 16:02:15 +0000 Received: from localhost ([127.0.0.1]:47331 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jgsJe-0000sn-Tv for submit@debbugs.gnu.org; Thu, 04 Jun 2020 12:02:15 -0400 Received: from eggs.gnu.org ([209.51.188.92]:35734) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jgsJd-0000mW-54 for 37564@debbugs.gnu.org; Thu, 04 Jun 2020 12:02:01 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:35310) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jgsJX-0002sN-27; Thu, 04 Jun 2020 12:01:55 -0400 Received: from rgm by fencepost.gnu.org with local (Exim 4.82) (envelope-from ) id 1jgsJV-00037n-1h; Thu, 04 Jun 2020 12:01:53 -0400 From: Glenn Morris To: Eli Zaretskii Subject: Re: bug#37564: [PATCH] don't export LINES and COLUMNS env vars in term to fix ncurses applications References: <87y2y5lfnb.fsf@1e0.co.uk> <83eezxatsv.fsf@gnu.org> <87tv8slb6w.fsf@mattleach.net> <83a7aka1q5.fsf@gnu.org> <87sgocfh8c.fsf@mattleach.net> <83y2y48f8u.fsf@gnu.org> <87o8z0few1.fsf@mattleach.net> <83sgob98zk.fsf@gnu.org> <9ipnjdemzv.fsf@fencepost.gnu.org> <878sq0jqi6.fsf@mattleach.net> <87o8uyrlja.fsf@marxist.se> <83pnfevsbv.fsf@gnu.org> <7nd0bd8w1e.fsf@fencepost.gnu.org> <83eevrv6hk.fsf@gnu.org> X-Spook: jihad RSA credit card initiative MS-13 NWO data haven JPL X-Ran: !k+c.KV>Td"ip)~c*}]Dw7T9|zi}E"N}#P]$S9k/b)3@b^_%?`Op9|fDDz-F@~Qu_%CL|g X-Hue: yellow X-Attribution: GM Date: Thu, 04 Jun 2020 12:01:52 -0400 In-Reply-To: <83eevrv6hk.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 22 Jan 2020 17:46:47 +0200") Message-ID: <75h7vq6cr3.fsf@fencepost.gnu.org> User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -1.6 (-) X-Debbugs-Envelope-To: 37564 Cc: matthew@mattleach.net, 37564@debbugs.gnu.org, stefan@marxist.se X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.6 (--) Eli Zaretskii wrote: > I understand that applications based on ncurses are affected, but what > about those which aren't based on ncurses? I can only repeat my comments from https://debbugs.gnu.org/37564#32 no terminal emulator / shell combination actually exports LINES and COLUMNS as environment variables, except for Emacs term.el. So no application can be relying on the LINES and COLUMNS environment variables (since there aren't any applications specifically for use inside Emacs's term). From debbugs-submit-bounces@debbugs.gnu.org Sat Aug 15 08:37:48 2020 Received: (at 37564) by debbugs.gnu.org; 15 Aug 2020 12:37:48 +0000 Received: from localhost ([127.0.0.1]:54419 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k6vRT-0008V3-VY for submit@debbugs.gnu.org; Sat, 15 Aug 2020 08:37:48 -0400 Received: from quimby.gnus.org ([95.216.78.240]:53492) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k6vRS-0008Ul-5p for 37564@debbugs.gnu.org; Sat, 15 Aug 2020 08:37:47 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=Oc/4uE6kqiCFSEwYJHVcWXCr2GgjjGX9KNaR2Z89TeU=; b=hvYAmOGApMm1/OWSUCxs6hyHgQ vZk6DCUw9jOdO2lw99oHh2Yx2A6z3L7sAA0sEntC/gDO3BkdvbiUz5lHimfDY7yI/CY1p1L8VV/dP YS+Ym0GvrDg8aJR/mSOB39qMej/Sidkk/KPNllbk+2YvEfKFdcgIHSe9Kr3GQLdETw9g=; Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=xo) by quimby with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1k6vR9-0007YM-R6; Sat, 15 Aug 2020 14:37:39 +0200 From: Lars Ingebrigtsen To: Eli Zaretskii Subject: Re: bug#37564: [PATCH] don't export LINES and COLUMNS env vars in term to fix ncurses applications References: <87y2y5lfnb.fsf@1e0.co.uk> <83eezxatsv.fsf@gnu.org> <87tv8slb6w.fsf@mattleach.net> <83a7aka1q5.fsf@gnu.org> <87sgocfh8c.fsf@mattleach.net> <83y2y48f8u.fsf@gnu.org> <87o8z0few1.fsf@mattleach.net> <83sgob98zk.fsf@gnu.org> <9ipnjdemzv.fsf@fencepost.gnu.org> <878sq0jqi6.fsf@mattleach.net> <87o8uyrlja.fsf@marxist.se> <83pnfevsbv.fsf@gnu.org> <7nd0bd8w1e.fsf@fencepost.gnu.org> <83eevrv6hk.fsf@gnu.org> X-Now-Playing: Archie Shepp's _The Cry Of My People_: "A Prayer" Date: Sat, 15 Aug 2020 14:37:26 +0200 In-Reply-To: <83eevrv6hk.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 22 Jan 2020 17:46:47 +0200") Message-ID: <87a6ywxeyh.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Eli Zaretskii writes: >> PS for an example of the effect, one can use some of the programs in >> the ncurses-examples from >> https://invisible-island.net/ncurses/ncurses-examples.html >> >> eg "worm". > > I understand tha [...] Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 37564 Cc: Glenn Morris , 37564@debbugs.gnu.org, stefan@marxist.se, matthew@mattleach.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Eli Zaretskii writes: >> PS for an example of the effect, one can use some of the programs in >> the ncurses-examples from >> https://invisible-island.net/ncurses/ncurses-examples.html >> >> eg "worm". > > I understand that applications based on ncurses are affected, but what > about those which aren't based on ncurses? I think the rough consensus here was that adding LINES/COLUMNS is usually the wrong thing to do, but Eli worries that this might break something. So I've applied Matthew's patch, but also added a defcustom to control this. I've defaulted the variable to "don't add the variables", but if this leads to problems during the Emacs 28.1 cycle, we can flip it to "on" later. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From debbugs-submit-bounces@debbugs.gnu.org Sat Aug 15 08:37:54 2020 Received: (at control) by debbugs.gnu.org; 15 Aug 2020 12:37:54 +0000 Received: from localhost ([127.0.0.1]:54422 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k6vRa-0008VQ-AT for submit@debbugs.gnu.org; Sat, 15 Aug 2020 08:37:54 -0400 Received: from quimby.gnus.org ([95.216.78.240]:53506) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k6vRY-0008V1-In for control@debbugs.gnu.org; Sat, 15 Aug 2020 08:37:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Subject:From:To:Message-Id:Date:Sender:Reply-To:Cc: MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=TjWMUu1Mkt9vLWcaGFXZ5SKYBAzsbEigvuhtFZYJ5e8=; b=Of7JqiXzel+b8NWIMVkey4YTds nOtfD82y9cxhJJx3C8mzfDJs4TObuFB1aQ9vLhGGUXIhIAN3P1Sg+OsoleZMJkRlZfU0Kber9Q78r tuvuzLdAc40lnYzqAgCheRPzNjEGynnnldE9HPHpy5kBt/5Ahp2cGEH5S3j/UKbt+3zU=; Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=xo) by quimby with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1k6vRQ-0007Yc-Qy for control@debbugs.gnu.org; Sat, 15 Aug 2020 14:37:47 +0200 Date: Sat, 15 Aug 2020 14:37:43 +0200 Message-Id: <878segxey0.fsf@gnus.org> To: control@debbugs.gnu.org From: Lars Ingebrigtsen Subject: control message for bug #37564 X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: tags 37564 fixed close 37564 28.1 quit Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) tags 37564 fixed close 37564 28.1 quit From debbugs-submit-bounces@debbugs.gnu.org Thu Aug 20 20:36:24 2020 Received: (at control) by debbugs.gnu.org; 21 Aug 2020 00:36:24 +0000 Received: from localhost ([127.0.0.1]:44491 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k8v2e-0000ln-3R for submit@debbugs.gnu.org; Thu, 20 Aug 2020 20:36:24 -0400 Received: from mail-yb1-f169.google.com ([209.85.219.169]:36351) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k8v2a-0000lW-FO for control@debbugs.gnu.org; Thu, 20 Aug 2020 20:36:22 -0400 Received: by mail-yb1-f169.google.com with SMTP id g3so148899ybc.3 for ; Thu, 20 Aug 2020 17:36:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:mime-version:date:message-id:subject:to; bh=zy5wT+FUSXjNtxanUnm13GKTAf3hfrDk1oAvzyL0LPg=; b=J0A2UkRFDNEywwmigWqJ09EPbj4DdlswTZsb+KyCoC3B55lIoMSm2F0tC9cvcGohxT l8nVz8oA0LnP39FvObH+BaHcc17cQ5eNAhp90MCZuzbA3xa7m5sOo0HPKoU8J7y4VdQM 7V3zYSH+GJ62mKWa40kGcuTT+7R9yN1W7PTbIcXfJszjXwByL2vYPXX48AEA2oxQkDgv 1XGPZbLiZvNT4FE6YsLi/JPmRsunBQOmbT5ocyVpFnFDwMCsO8HTQyUOKo58OQMfvIGa o7kFBjXEgAWYnce3sD7Nim53LveVQlzDG7Edq6ni+QN/UQcuU/O2bB8I0SN1aNlrTz9m no9A== X-Gm-Message-State: AOAM532zjKFPKTNC6mG7xSLK27oZt1n1NO1BjGWVxdNnsrugopWeUHYU mO5PbaHi2j/OxV9CSFCnEoiYPJod3A6RmhtL0ZBXBC3Xc14= X-Google-Smtp-Source: ABdhPJxflLQf7qIw/aUyjdMpOCblmZT2NnBR7IT1SjLuNEezm0mMiaxTOPJPP6x/8MiiKQHxC5MMyn+ciPDQuUMXxjM= X-Received: by 2002:a25:880e:: with SMTP id c14mr467480ybl.181.1597970174819; Thu, 20 Aug 2020 17:36:14 -0700 (PDT) Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Thu, 20 Aug 2020 17:36:14 -0700 From: Stefan Kangas MIME-Version: 1.0 Date: Thu, 20 Aug 2020 17:36:14 -0700 Message-ID: Subject: To: control@debbugs.gnu.org Content-Type: text/plain; charset="UTF-8" X-Spam-Score: 2.5 (++) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: forcemerge 37564 11432 thanks Content analysis details: (2.5 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (stefankangas[at]gmail.com) -0.0 SPF_PASS SPF: sender matches SPF record 0.2 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [209.85.219.169 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [209.85.219.169 listed in wl.mailspike.net] 2.0 BLANK_SUBJECT Subject is present but empty 0.2 FREEMAIL_FORGED_FROMDOMAIN 2nd level domains in From and EnvelopeFrom freemail headers are different 0.0 UNPARSEABLE_RELAY Informational: message has unparseable relay lines X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 1.5 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: forcemerge 37564 11432 thanks Content analysis details: (1.5 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [209.85.219.169 listed in wl.mailspike.net] -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [209.85.219.169 listed in list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (stefankangas[at]gmail.com) -0.0 SPF_PASS SPF: sender matches SPF record 0.2 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 2.0 BLANK_SUBJECT Subject is present but empty -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager 0.2 FREEMAIL_FORGED_FROMDOMAIN 2nd level domains in From and EnvelopeFrom freemail headers are different 0.0 UNPARSEABLE_RELAY Informational: message has unparseable relay lines forcemerge 37564 11432 thanks From unknown Fri Jun 13 10:18:59 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Fri, 18 Sep 2020 11:24:05 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator