* debian/rules, usr/bin/byobu.in, usr/bin/byobu-launcher.in,

usr/bin/ctail, usr/lib/byobu/include/select-session.py:
  - silence some checkbashisms false positives
  - handle nesting a bit differently
  - allow nesting, by default
  - detect the infinite loop situation, where we're ssh'ing into
    ourselves, and handle it gracefully
  - ensure we have access to 256 colors, even when nesting
This commit is contained in:
Dustin Kirkland 2015-01-12 17:27:24 -06:00
commit 2a59d62e62
6 changed files with 19 additions and 25 deletions

9
debian/changelog vendored
View file

@ -1,6 +1,13 @@
byobu (5.89) unreleased; urgency=medium
* UNRELEASED
* debian/rules, usr/bin/byobu.in, usr/bin/byobu-launcher.in,
usr/bin/ctail, usr/lib/byobu/include/select-session.py:
- silence some checkbashisms false positives
- handle nesting a bit differently
- allow nesting, by default
- detect the infinite loop situation, where we're ssh'ing into
ourselves, and handle it gracefully
- ensure we have access to 256 colors, even when nesting
-- Dustin Kirkland <kirkland@ubuntu.com> Thu, 08 Jan 2015 16:01:27 -0600

2
debian/rules vendored
View file

@ -8,7 +8,7 @@ override_dh_auto_build:
# Check shell syntax
sh -n `find . -type f -exec grep -l "^\#\!/bin/sh" '{}' \;`
# Check for bashisms in shell scripts
checkbashisms `find . -type f -exec grep -l "^\#\!/bin/sh" '{}' \;` || true
checkbashisms `find . -type f -exec grep -l "^\#\!/bin/sh" '{}' \;` 2>&1 | grep "^possible bashism in " | grep -v "sleep only takes one integer" | grep -v "sourced script with arguments" || true
dh_auto_build
override_dh_perl:

View file

@ -30,9 +30,14 @@ if [ -O "$HOME" ]; then
case "$TERM" in
*screen*)
# Handle nesting
if [ -n "$LC_BYOBU" ] && [ "$LC_BYOBU" -gt 1 ]; then
# LC_BYOBU > 1, so user explicitly wants nested sessions
exec $BYOBU_PREFIX/bin/byobu "$@"
if [ -n "$LC_BYOBU" ] && [ "$LC_BYOBU" -gt 0 ]; then
# User explicitly wants nested sessions
if [ -n "$SSH_CONNECTION" ] && [ "$(printf "$SSH_CONNECTION" | awk '{print $1}')" != "$(printf "$SSH_CONNECTION" | awk '{print $3}')" ]; then
# Safeguard against ssh-ing into ourself, which causes an infinite loop
exec $BYOBU_PREFIX/bin/byobu "$@"
else
true
fi
else
true
fi

View file

@ -110,7 +110,7 @@ case $BYOBU_BACKEND in
tmux)
# Use 256 colors if possible
if $BYOBU_TEST tput >/dev/null; then
if [ "$(tput colors 2>/dev/null || echo 0)" = "256" ] || [ "$COLORTERM" = "gnome-terminal" ] || [ "$TERM" = "xterm" ] || [ "$TERM" = "xterm-256color" ]; then
if [ "$(tput colors 2>/dev/null || echo 0)" = "256" ] || [ "$COLORTERM" = "gnome-terminal" ] || [ "$TERM" = "xterm" ] || [ "$TERM" = "xterm-256color" ] || [ "$TERM" = "screen" ]; then
[ -z "$SCREEN_TERM" ] && SCREEN_TERM="-2"
fi
fi

View file

@ -19,7 +19,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
if command -v ccze >/dev/null 2>&1; then
if which ccze >/dev/null 2>&1; then
tail -F $@ | ccze -A
else
echo "ERROR: ccze not found, hint..." 1>&2

View file

@ -102,24 +102,6 @@ def attach_session(session):
else:
os.execvp("screen", ["", "-AOxRR", session_name])
# Confirm nested session, if necessary
if os.getenv("BYOBU_NESTING", "0") != "1":
if (BYOBU_BACKEND == "tmux" and os.getenv("TMUX")) or (BYOBU_BACKEND == "screen" and "screen" in os.getenv("TERM")):
sys.stderr.write("WARNING: Sessions should be nested with care.\n")
try:
nest = raw_input("Are you sure you want to run Byobu inside another session? [y/N]: ")
if nest != "Y" and nest != "y":
sys.exit(1)
else:
if os.getenv("TMUX"):
os.unsetenv("TMUX")
except KeyboardInterrupt:
sys.stdout.write("\n")
sys.exit(1)
except:
sys.stdout.write("\n")
sys.exit(1)
sessions = get_sessions()
show_shell = os.path.exists("%s/.always-select" % (BYOBU_CONFIG_DIR))