Package: zsh
Version: 5.9-1
Severity: normal
Tags: upstream patch
Forwarded: https://www.zsh.org/mla/workers/2022/msg00888.html

On some of my machines, I have $VISUAL and $EDITOR set to
"/home/vinc17/bin/eclient", and because the "vi" sequence
appears in this string (here, in my username), zsh thinks
that I use vi and selects the vi bindings.

I've attached Bart Schaefer's patch from

  https://www.zsh.org/mla/workers/2022/msg00889.html

so that only the part after the last "/" is considered (this
is better than the current code and probably OK in practice,
though it could still match command options if any).

-- Package-specific info:

Packages which provide vendor completions:

Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name             Version             Architecture Description
+++-================-===================-============-=======================================================================
ii  bubblewrap       0.6.2-1             amd64        utility for unprivileged 
chroot and namespace manipulation
ii  curl             7.84.0-2            amd64        command line tool for 
transferring data with URL syntax
ii  dpkg-dev         1.21.9              all          Debian package 
development tools
ii  git-extras       6.4.0-1             all          Extra commands for git
ii  mercurial-common 6.2-1               all          easy-to-use, scalable 
distributed version control system (common files)
ii  meson            0.63.1-1            all          high-productivity build 
system
ii  ninja-build      1.11.0-1            amd64        small build system 
closest in spirit to Make
ii  pass             1.7.4-5             all          lightweight 
directory-based password manager
ii  pulseaudio-utils 15.0+dfsg1-4+local1 amd64        Command line tools for 
the PulseAudio sound server
ii  qpdf             10.6.3-1            amd64        tools for transforming 
and inspecting PDF files
ii  systemd          251.4-1             amd64        system and service manager
ii  udev             251.4-1             amd64        /dev/ and hotplug 
management daemon
ii  vlc-bin          3.0.17.4-3          amd64        binaries from VLC
ii  youtube-dl       2021.12.17-1        all          downloader of videos from 
YouTube and other sites
ii  zathura          0.4.9-1             amd64        document viewer with a 
minimalistic interface

The following files were modified:

/etc/systemd/logind.conf
/etc/systemd/system.conf
/etc/systemd/journald.conf

dpkg-query: no path found matching pattern /usr/share/zsh/vendor-functions/


-- System Information:
Debian Release: bookworm/sid
  APT prefers unstable-debug
  APT policy: (500, 'unstable-debug'), (500, 'stable-updates'), (500, 
'stable-security'), (500, 'unstable'), (500, 'testing'), (500, 'stable'), (1, 
'experimental')
merged-usr: no
Architecture: amd64 (x86_64)

Kernel: Linux 5.18.0-4-amd64 (SMP w/8 CPU threads; PREEMPT)
Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_OOT_MODULE, 
TAINT_UNSIGNED_MODULE
Locale: LANG=POSIX, LC_CTYPE=C.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages zsh depends on:
ii  libc6       2.34-7
ii  libcap2     1:2.44-1
ii  libtinfo6   6.3+20220423-2
ii  zsh-common  5.9-1

Versions of packages zsh recommends:
ii  libncursesw6  6.3+20220423-2
ii  libpcre3      2:8.39-14

Versions of packages zsh suggests:
ii  zsh-doc  5.9-1

-- no debconf information

-- 
Vincent Lefèvre <[email protected]> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)
diff --git a/Src/Zle/zle_keymap.c b/Src/Zle/zle_keymap.c
index d90838f03..8e5ad3fa2 100644
--- a/Src/Zle/zle_keymap.c
+++ b/Src/Zle/zle_keymap.c
@@ -1454,8 +1454,8 @@ default_bindings(void)
     linkkeymap(oppmap, "viopp", 0);
     linkkeymap(vismap, "visual", 0);
     linkkeymap(smap, ".safe", 1);
-    if (((ed = zgetenv("VISUAL")) && strstr(ed, "vi")) ||
-	((ed = zgetenv("EDITOR")) && strstr(ed, "vi")))
+    if (((ed = zgetenv("VISUAL")) && strstr(ed, "vi") > rindex(ed, '/')) ||
+	((ed = zgetenv("EDITOR")) && strstr(ed, "vi") > rindex(ed, '/')))
 	linkkeymap(vmap, "main", 0);
     else
 	linkkeymap(emap, "main", 0);

Reply via email to