Package: libvte-2.91-common
Version: 0.58.0-1
Severity: important
Tags: patch

Dear Maintainer,

At the start of my $HOME/.bashrc I have configured "set -u" to catch the use of undefined variables.

Whenever I open a new gnome-terminal window using bash as the shell, the script vte-2.91.sh will emit two messages about dereferencing an undefined variable ZSH_VERSION.

The script starts like this:

# Not bash or zsh?
[ -n "$BASH_VERSION" -o -n "$ZSH_VERSION" ] || return 0

# Not an interactive shell?
[[ $- == *i* ]] || return 0

# Not running under vte?
[ "${VTE_VERSION:-0}" -ge 3405 ] || return 0

Note: for VTE_VERSION, the correct pattern is being used. I believe that that pattern is POSIX shell compliant; at least it works in /bin/dash.

The attached patch fixes the problem for me.

I hope that you can apply this patch to the Debian packages or submit it upstream. I think that this bug has been present for years, but I did not investigate or file it until now.

Best regards,

        Marko

-- System Information:
Debian Release: bullseye/sid
 APT prefers unstable
 APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 5.2.0-2-amd64
Locale: LANG=fi_FI.UTF-8, LC_CTYPE=fi_FI.UTF-8 (charmap=UTF-8), 
LANGUAGE=fi_FI.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

-- no debconf information
--- /etc/profile.d/vte-2.91.sh
+++ /etc/profile.d/vte-2.91.sh
@@ -15,7 +15,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 # Not bash or zsh?
-[ -n "$BASH_VERSION" -o -n "$ZSH_VERSION" ] || return 0
+[ -n "${BASH_VERSION:-}" -o -n "${ZSH_VERSION:-}" ] || return 0
 
 # Not an interactive shell?
 [[ $- == *i* ]] || return 0
@@ -58,8 +58,8 @@
 
 case "$TERM" in
   xterm*|vte*)
-    [ -n "$BASH_VERSION" ] && PROMPT_COMMAND="__vte_prompt_command"
-    [ -n "$ZSH_VERSION"  ] && precmd_functions+=(__vte_osc7)
+    [ -n "${BASH_VERSION:-}" ] && PROMPT_COMMAND="__vte_prompt_command"
+    [ -n "${ZSH_VERSION:-}"  ] && precmd_functions+=(__vte_osc7)
     ;;
 esac
 

Reply via email to