From 68226283cb76d87306034f0fc8b337044c578d47 Mon Sep 17 00:00:00 2001 From: Alex Chernyakhovsky Date: Wed, 26 Oct 2022 18:18:39 -0400 Subject: [PATCH] Disable emulation-attributes-bce on tmux 3.3a tmux 3.3a has a behavior change, since reverted, that is incompatible with this test. Unfortunately, tmux 3.3a has already made it into some distributions, so the test has to be disabled when tmux 3.3a is encountered. --- src/tests/e2e-test-subrs | 18 ++++++++++++++---- src/tests/emulation-attributes.test | 8 ++++++++ 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/src/tests/e2e-test-subrs b/src/tests/e2e-test-subrs index 8f2054b..d1d84f1 100644 --- a/src/tests/e2e-test-subrs +++ b/src/tests/e2e-test-subrs @@ -81,6 +81,19 @@ set_locale() return 1 } +# Given two versions, return success if the first version is less than +# or equal to the second version. +versionlte() +{ + [ "$1" = "$(printf "$1\n$2\n" | sort -V | head -n1)" ] +} +versionlt() { + if [ "$1" = "$2" ]; then + return 1 + fi + versionlte "$1" "$2" +} + # Tmux check. tmux_check() { @@ -103,11 +116,8 @@ tmux_check() return 0 fi version=${version##tmux } - version_major=${version%%.*} - version_minor=${version##*.} - if [ "$version_major" -lt "$need_major" ] || - { [ "$version_major" -eq "$need_major" ] && [ "$version_minor" -lt "$need_minor" ]; }; then + if versionlt "$version" "$need_major.$need_minor"; then printf "tmux version %s too old\n" "$version" >&2 return 1 fi diff --git a/src/tests/emulation-attributes.test b/src/tests/emulation-attributes.test index e4ba2f3..7e22019 100755 --- a/src/tests/emulation-attributes.test +++ b/src/tests/emulation-attributes.test @@ -27,6 +27,14 @@ if [ "$(basename "$0")" = emulation-attributes-bce.test ] && exit 77 fi +# tmux 3.3a has a behavior change in how BCE is handled, which has +# been reverted: https://github.com/tmux/tmux/issues/3339 +if [ "$(basename "$0")" = emulation-attributes-bce.test ] && + tmux_check 3 3a && ! tmux_check 3 3b; then + printf "tmux 3.3a has incompatible BCE behavior\n" >&2 + exit 77 +fi + # Top-level wrapper. if [ $# -eq 0 ]; then e2e-test "$0" baseline direct verify