• Bug#1102340: python3-argcomplete: global zsh completions breaks complet

    From Vincent Lefevre@21:1/5 to All on Tue Apr 8 04:40:02 2025
    Package: python3-argcomplete
    Version: 3.1.4-1
    Severity: critical
    Justification: breaks unrelated software

    In bug 944469, Daniel Kahn Gillmor (in Cc) requested activation
    of global bash completions. As a fix introduced in 3.1.4-1,
    Stefano Rivera (in Cc) activated global completions for both
    bash and zsh, though zsh was *not* mentioned before in this
    bug:

    https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=944469#15

    The issue is that for zsh, these global completions break
    completions that are unrelated to python, in an obscure way:

    https://www.zsh.org/mla/workers/2025/msg00129.html
    https://gitlab.archlinux.org/archlinux/packaging/packages/python-argcomplete/-/issues/3#note_191786

    One of the bugs can be reproduced with all versions since 3.1.4-1
    (stable has 2.0.0-1, which is not affected, as I could test) by
    using "zsh -f" then

    rm -f ~/.zcompdump; mkdir -p testdir; touch $_/FOO; autoload -U compinit; $_ -D; zstyle ':completion:*' matcher-list '' 'm:{a-zA-Z}={A-Za-z}'; print -z : testdir/f

    (this will create a "testdir" directory with a file "FOO" in it;
    make sure that if "testdir" already exists, it does not contain
    other files) then type the <tab> key: the completion fails.

    Typing <tab> a second time makes the completion succeed, giving

    : testdir/FOO

    as expected (once completed, the completion will always succeed
    in this shell session).

    Note that with python3-argcomplete 3.6.1-1, even a second <tab>
    fails to complete (see bug 1101675), and the corresponding change
    will be reverted. But the original issues will still be present.
    They had been occurring for months on one of my machines (after python3-argcomplete got installed via a dependency, so that I did
    not notice this package), but I could find the cause only when
    the completion system got even more broken with 3.6.1-1.

    A second one:

    rm -f ~/.zcompdump; mkdir -p testdir; touch $_/ab-cd; autoload -U compinit; $_ -D; zstyle ':completion:*' matcher-list '' 'r:|[._-]=* r:|=*'; print -z : testdir/a-c

    As said by Ronan Pigott in the Arch Linux bug above:

    Upstream chose to "fix" this by installing this completer as -default-
    which is an improvement I guess, but still undoubtedly, fundamentally
    broken. I filed https://github.com/kislyuk/argcomplete/issues/491 to
    hopefully raise awareness of this upstream.

    In the meantime, please remove this file from the Arch Linux
    distribution of this package. Ideally neither the "compdef -P *"
    nor the "fixed" -default- version should ever ship by default,
    in any distro. The #zsh irc is inundated with unsuspecting users
    getting bit by this, and the only recourse really is to NoExtract
    this completer, since a few common and useful packages, like
    ipython, have pulled it in as a dependency and wrecked the
    users's shell.

    Upstream closed the bug after saying

    Argcomplete does not activate global completion by default and
    does not recommend that distributions activate it by default.
    Global completion is meant to be activated by the user.

    So, upstream's recommendation should be followed.

    Note that this applies to zsh. I don't know what should be done
    for bash (maybe no bugs at all there).

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

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

    Versions of packages python3-argcomplete depends on:
    ii python3 3.13.2-2

    python3-argcomplete recommends no packages.

    python3-argcomplete suggests no packages.

    -- no debconf information

    --
    Vincent Lefèvre <vincent@vinc17.net> - Web: <https://www.vinc17.net/>
    100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
    Work: CR INRIA - computer arithmetic / Pascaline project (LIP, ENS-Lyon)

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)