* Carsten Hey [2015-07-28 16:11 +0200]:
> clear_console normally does not clear an xterm, but after running su
> it does,

This is a .bash_logout problem, the code below fixes this.

> and (run through skel.bash_logout) it also clears after running ssh on
> tty1.

This is actually a clear_console problem, the code below works around
this, and if clear_console would do what it should, it would still be
a significant performance improvement.

Maybe you should throw away clear_console and replace it with a simple
shell script that runs getopts, prints the message known from
clear_console if -q is not used and no terminal was detected (I would
have added a -v option instead and made -q default) and contains the
inner case snippet from the code below.

> Also, skel.bash_logout sometimes fails with exit code 1 although it
> should not,

The code below contains the fix: add a : as last line.

> and it is neither set -e nor set -u safe.

Use "${VAR-}", not "$VAR" and add "&& :" to commands that could fail.
Also fixed below.


Unless noted otherwise, anything below is too trivial to be
copyrightable.

# The author of the “if [ "$SHLVL" = 1 ]; then” part of below condition
# is Matthias Klose, see /usr/share/doc/bash/copyright on Debian or
# Ubuntu for copyright and license information.
if [ "${SHLVL-}|${SSH_CONNECTION-}" = "1|" ]; then
    case ${0##*/} in
    (-su|su)
        ;;
    (*)
        # This is a replacement for console_clear, which is broken.
        # After console_clear has been rewritten, it will be able to
        # replace below code.
        #
        # The glob to detect consoles below is:
        #   Copyright (C) 2011 Anton Zinoviev, and published under
        #   the license terms found in /usr/share/doc/expat/copyright,
        #   commonly known as MIT license.
        if [ -x /usr/bin/tty ]; then
            case $(/usr/bin/tty) in
            (/dev/tty[1-9]*|/dev/vc/[0-9]*|/dev/console|/dev/ttyv[0-9]*)
                [ -x /usr/bin/clear ] && /usr/bin/clear && :
                ;;
            esac
        fi
        ;;
    esac
fi

:


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to