public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Ken Brown <kbrown@cornell.edu>
To: cygwin@cygwin.com
Subject: Re: Terminal output disappearing after SSH into cygwin
Date: Fri, 22 Jan 2021 10:27:15 -0500	[thread overview]
Message-ID: <adf953c8-778b-a5ea-3701-041688811a0d@cornell.edu> (raw)
In-Reply-To: <9a0ce80d-fcdb-9f07-788c-c157a2de8535@SystematicSw.ab.ca>

On 1/22/2021 3:16 AM, Brian Inglis wrote:
> On 2021-01-21 09:02, matthew patton via Cygwin wrote:
>> On Thursday, January 21, 2021, 10:49:14 AM EST, Martyn B wrote:
>>> On 2021-01-21 11:13, Ken Brown via Cygwin wrote:
>>>> There's also /etc/bash.bash_logout.  The default version of that clears the 
>>>> screen:
>>>>
>>>> $ cat /etc/defaults/etc/bash.bash_logout
>>>> [...]
>>>> # base-files version 4.3-2
>>>>
>>>> # /etc/bash.bash_logout: executed by bash(1) when login shell exits.
>>>>
>>>> # The latest version as installed by the Cygwin Setup program can
>>>> # always be found at /etc/defaults/etc/bash.bash_logout
>>>>
>>>> # Modifying /etc/bash.bash_logout directly will prevent
>>>> # setup from updating it.
>>>>
>>>> # System-wide bashrc file
>>>>
>>>> # when leaving the console clear the screen to increase privacy
>>>> if [ "$SHLVL" = 1 ]; then
>>>>    [ -x /usr/bin/clear ] && /usr/bin/clear
>>>> fi
> 
>>> 1) understand why this happens. - Is this the Cygwin standard behavior?
> 
>> Not in the slightest.
> 
> It appears to be so:
> 
> $ cygcheck -f /etc/defaults/etc/bash.bash_logout
> base-files-4.3-2
> $ ls /etc/**/*bash_logout
> /etc/bash.bash_logout  /etc/defaults/etc/bash.bash_logout
> $ zgrep bash_logout /etc/**/base-files*
> /etc/preremove/base-files-manifest.lst:etc/bash.bash_logout
> /etc/setup/base-files.lst.gz:etc/defaults/etc/bash.bash_logout
> 
> Whether it should be is a good question.
> 
> There's no /etc/bash_logout file under Debian, etc. but /etc/skel/.bash_logout 
> and ~/.bash_logout also have the same clear screen code.
> 
> Is (or was) /etc/bash.bash_logout that did this in the bash sources or under 
> Fedora, which is the Linux basis for some Cygwin approaches, behaviour, and 
> conventions?

There are two separate issues here.  The first is that Cygwin's bash executes 
/etc/bash.bash_logout.  The second is that the default /etc/bash.bash_logout 
clears the screen.

The first issue is dealt with in the bash sources.  It is an option that is 
disabled by default, but Cygwin's bash maintainer chose to enable it.  That's 
done in the following hunk from bash-4.4.12-3.src.patch:

--- origsrc/bash-4.4/config-top.h	2016-05-19 13:34:02.000000000 -0500
+++ src/bash-4.4/config-top.h	2017-01-27 13:11:50.793821100 -0600
@@ -87,10 +87,10 @@
  #define DEFAULT_BASHRC "~/.bashrc"

  /* System-wide .bashrc file for interactive shells. */
-/* #define SYS_BASHRC "/etc/bash.bashrc" */
+#define SYS_BASHRC "/etc/bash.bashrc"

  /* System-wide .bash_logout for login shells. */
-/* #define SYS_BASH_LOGOUT "/etc/bash.bash_logout" */
+#define SYS_BASH_LOGOUT "/etc/bash.bash_logout"

  /* Define this to make non-interactive shells begun with argv[0][0] == '-'
     run the startup files when not in posix mode. */

I've added Eric to the CC in case he wants to comment.

I don't know the history of the second issue, but that's a matter for Achim as 
base-files maintainer.

Ken

      parent reply	other threads:[~2021-01-22 15:27 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-21 13:08 Martyn B
2021-01-21 13:13 ` Takashi Yano
2021-01-21 13:29   ` Takashi Yano
2021-01-21 14:45     ` Martyn B
2021-01-21 17:28       ` Takashi Yano
2021-01-21 18:13         ` Ken Brown
2021-01-21 18:30           ` Takashi Yano
2021-01-21 19:06             ` matthew patton
2021-01-21 19:32             ` Ken Brown
2021-01-21 15:13 ` Marco Atzeri
2021-01-21 15:49   ` Martyn B
2021-01-21 16:02     ` matthew patton
2021-01-22  8:16       ` Brian Inglis
2021-01-22 11:10         ` Marco Atzeri
2021-01-22 13:18           ` (SOLVED) " Martyn B
2021-01-22 16:16           ` Thomas Wolff
2021-01-23 13:22             ` Martyn B
2021-01-23 14:50               ` Thomas Wolff
2021-01-22 15:27         ` Ken Brown [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=adf953c8-778b-a5ea-3701-041688811a0d@cornell.edu \
    --to=kbrown@cornell.edu \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).