Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[BUG] Tab completion causes 100% memory usage and severe delay in zh_CN.UTF-8 locale | [mod=x-cmd] [v0.6.13]Β #308

@ansar1907

Description

@ansar1907

βœ… Checklist

πŸ’¬ Describe the bug

When the system and x-cmd locale are set to Chinese (zh_CN.UTF-8 or zh), attempting to use Tab completion for the x command causes a critical performance issue.

After typing x (x and a space) and pressing the Tab key, the system immediately freezes or becomes unresponsive. System monitoring tools (like htop) show that a process related to x-cmd's is rapidly consuming all available memory until it hits 100%. After a long delay of several seconds or more, once the memory is maxed out, the completion suggestions finally appear.
The memory is then released, and the system returns to normal.

This issue makes the Tab completion feature unusable in a Chinese language environment.

πŸ“„ System

- name: x-cmd
  info: |-
    ___X_CMD_PKG_VERSION:       v0.1.2
    ___X_CMD_WEBSRC_REGION:     cn
    ___X_CMD_LANG:              zh

    ==== x-cmd version ====
    version: .04b1d1b7
    tag: v0.6.10
    date: 2025-08-16 03:06:11+0000
    sum: 04b1d1b72e4a5dce13112d7a0ce4da7d8b46df549a71ecfea5479e046004de707eac3ba2e8b5690cff752ba44244c7ffbd377fd172a986adc3954d95b810e5dd

    ==== root ls ====
    V:          <<HOME-STRING>>/.x-cmd.root/v
    ROOT:       <<HOME-STRING>>/.x-cmd.root
    CODE:       <<HOME-STRING>>/.x-cmd.root/v/.04b1d1b7
    ADV:        <<HOME-STRING>>/.x-cmd.root/v/.04b1d1b7/adv
    MOD:        <<HOME-STRING>>/.x-cmd.root/v/.04b1d1b7/mod
    METADATA:   <<HOME-STRING>>/.x-cmd.root/v/.04b1d1b7/.x-cmd/metadata
    GDATA:      <<HOME-STRING>>/.x-cmd.root/global/data
    DATA:       <<HOME-STRING>>/.x-cmd.root/local/data
    USR:        <<HOME-STRING>>/.x-cmd.root/local/usr
    ART:        <<HOME-STRING>>/.x-cmd.root/local/art
    GCFG:       <<HOME-STRING>>/.x-cmd.root/global/cfg
    CFG:        <<HOME-STRING>>/.x-cmd.root/local/cfg
    LOG:        <<HOME-STRING>>/.x-cmd.root/local/log
    CACHE:      <<HOME-STRING>>/.x-cmd.root/local/cache
    TMP:        <<HOME-STRING>>/.x-cmd.root/local/tmp
    SHARED:     <<HOME-STRING>>/.x-cmd.root/global/shared

    ==== boot rc ====
- name: shell
  info: bash
- name: awk
  info: mawk 1.3.4 20250131
- name: sed
  info: |-
    /usr/bin/sed (GNU sed) 4.9
    Packaged by Debian
    Copyright (C) 2022 Free Software Foundation, Inc.
    License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
    This is free software: you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law.

    Written by Jay Fenlason, Tom Lord, Ken Pizzini,
    Paolo Bonzini, Jim Meyering, and Assaf Gordon.

    This sed program was built with SELinux support.
    SELinux is disabled on this system.

    GNU sed home page: <https://www.gnu.org/software/sed/>.
    General help using GNU software: <https://www.gnu.org/gethelp/>.
    E-mail bug reports to: <[email protected]>.
- name: grep
  info: |-
    grep (GNU grep) 3.11
    Copyright (C) 2023 Free Software Foundation, Inc.
    License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
    This is free software: you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law.

    Written by Mike Haertel and others; see
    <https://git.savannah.gnu.org/cgit/grep.git/tree/AUTHORS>.

    grep -P uses PCRE2 10.45 2025-02-05
- name: find
  info: |-
    find (GNU findutils) 4.10.0
    Copyright (C) 2024 Free Software Foundation, Inc.
    License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
    This is free software: you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law.

    Written by Eric B. Decker, James Youngman, and Kevin Dalley.
    Features enabled: D_TYPE O_NOFOLLOW(enabled) LEAF_OPTIMISATION FTS(FTS_CWDFD) CBO(level=1)
- name: busybox
  info: |-
    BusyBox v1.37.0 (Debian 1:1.37.0-6+b3) multi-call binary.
    BusyBox is copyrighted by many authors between 1998-2015.
    Licensed under GPLv2. See source distribution for detailed
    copyright notices.

    Usage: busybox [function [arguments]...]
       or: busybox --list[-full]
       or: busybox --install [-s] [DIR]
       or: function [arguments]...

        BusyBox is a multi-call binary that combines many common Unix
        utilities into a single executable.  Most people will create a
        link to busybox for each function they wish to use and BusyBox
        will act like whatever it was invoked as.

    Currently defined functions:
        [, [[, acpid, adjtimex, ar, arch, arp, arping, ascii, ash, awk, base64,
        basename, bc, blkdiscard, blkid, blockdev, brctl, bunzip2, bzcat,
        bzip2, cal, cat, chgrp, chmod, chown, chroot, chvt, clear, cmp, cp,
        cpio, crc32, crond, crontab, cttyhack, cut, date, dc, dd, deallocvt,
        depmod, devmem, df, diff, dirname, dmesg, dnsdomainname, dos2unix,
        dpkg, dpkg-deb, du, dumpkmap, dumpleases, echo, ed, egrep, env, expand,
        expr, factor, fallocate, false, fatattr, fdisk, fgrep, find, findfs,
        fold, free, freeramdisk, fsfreeze, fstrim, ftpget, ftpput, getfattr,
        getopt, getty, grep, groups, gunzip, gzip, halt, head, hexdump, hostid,
        hostname, httpd, hwclock, i2cdetect, i2cdump, i2cget, i2cset,
        i2ctransfer, id, ifconfig, ifdown, ifup, init, insmod, install, ionice,
        ip, ipcalc, kill, killall, klogd, last, less, link, linux32, linux64,
        linuxrc, ln, loadfont, loadkmap, logger, login, logname, logread,
        losetup, ls, lsmod, lsscsi, lzcat, lzma, lzop, md5sum, mdev, microcom,
        mim, mkdir, mkdosfs, mke2fs, mkfifo, mknod, mkpasswd, mkswap, mktemp,
        modinfo, modprobe, more, mount, mt, mv, nameif, nbd-client, nc,
        netstat, nl, nologin, nproc, nsenter, nslookup, nuke, od, openvt,
        partprobe, passwd, paste, patch, pidof, ping, ping6, pivot_root,
        poweroff, printf, ps, pwd, rdate, readlink, realpath, reboot, renice,
        reset, resume, rev, rm, rmdir, rmmod, route, rpm, rpm2cpio, run-init,
        run-parts, sed, seq, setkeycodes, setpriv, setsid, sh, sha1sum,
        sha256sum, sha3sum, sha512sum, shred, shuf, sleep, sort, ssl_client,
        start-stop-daemon, stat, strings, stty, su, sulogin, svc, svok,
        swapoff, swapon, switch_root, sync, sysctl, syslogd, tac, tail, tar,
        taskset, tc, tee, telnet, test, tftp, time, timeout, top, touch, tr,
        traceroute, traceroute6, true, truncate, ts, tty, tunctl, ubirename,
        udhcpc, udhcpc6, udhcpd, uevent, umount, uname, uncompress, unexpand,
        uniq, unix2dos, unlink, unlzma, unshare, unxz, unzip, uptime, usleep,
        uudecode, uuencode, vconfig, vi, w, watch, watchdog, wc, wget, which,
        who, whoami, xargs, xxd, xz, xzcat, yes, zcat
- name: curl
  info: |-
    curl 8.14.1 (x86_64-pc-linux-gnu) libcurl/8.14.1 OpenSSL/3.5.1 zlib/1.3.1 brotli/1.1.0 zstd/1.5.7 libidn2/2.3.8 libpsl/0.21.2 libssh2/1.11.1 nghttp2/1.64.0 nghttp3/1.8.0 librtmp/2.3 OpenLDAP/2.6.10
    Release-Date: 2025-06-04, security patched: 8.14.1-2
    Protocols: dict file ftp ftps gopher gophers http https imap imaps ipfs ipns ldap ldaps mqtt pop3 pop3s rtmp rtsp scp sftp smb smbs smtp smtps telnet tftp ws wss
    Features: alt-svc AsynchDNS brotli GSS-API HSTS HTTP2 HTTP3 HTTPS-proxy IDN IPv6 Kerberos Largefile libz NTLM PSL SPNEGO SSL threadsafe TLS-SRP UnixSockets zstd
- name: wget
  info: |-
    GNU Wget 1.25.0 built on linux-gnu.

    -cares +digest -gpgme +https +ipv6 +iri +large-file -metalink +nls
    +ntlm +opie +psl +ssl/gnutls

    Wgetrc:
        /etc/wgetrc (system)
    Locale:
        /usr/share/locale
    Compile:
        gcc -DHAVE_CONFIG_H -DSYSTEM_WGETRC="/etc/wgetrc"
        -DLOCALEDIR="/usr/share/locale" -I. -I../../src -I../lib
        -I../../lib -Wdate-time -D_FORTIFY_SOURCE=2
        -I/usr/include/p11-kit-1 -DHAVE_LIBGNUTLS -DNDEBUG -g -O2
        -Werror=implicit-function-declaration
        -ffile-prefix-map=/build/reproducible-path/wget-1.25.0=.
        -fstack-protector-strong -fstack-clash-protection -Wformat
        -Werror=format-security -fcf-protection -DNO_SSLv2
    Link:
        gcc -I/usr/include/p11-kit-1 -DHAVE_LIBGNUTLS -DNDEBUG -g -O2
        -Werror=implicit-function-declaration
        -ffile-prefix-map=/build/reproducible-path/wget-1.25.0=.
        -fstack-protector-strong -fstack-clash-protection -Wformat
        -Werror=format-security -fcf-protection -DNO_SSLv2 -Wl,-z,relro
        -Wl,-z,now -lpcre2-8 -luuid -lidn2 -lnettle -lgnutls -lz -lpsl
        ../lib/libgnu.a

    Copyright (C) 2015 Free Software Foundation, Inc.
    License GPLv3+: GNU GPL version 3 or later
    <http://www.gnu.org/licenses/gpl.html>.
    This is free software: you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law.

    Originally written by Hrvoje Niksic <[email protected]>.
    Please send bug reports and questions to <[email protected]>.
- name: yq
  info:
- name: jq
  info:
- name: fzf
  info:
- name: release
  info: |-
    debian
    "13"

πŸ”Ž To Reproduce

1.Set the system locale to zh_CN.UTF-8. (e.g., export LANG=zh_CN.UTF-8).
2.Open a new terminal session (the issue occurs in both bash and zsh).
3.Type x (the letter 'x' followed by a space).
4.Press the Tab key.
5.Observe the immediate system freeze and the corresponding memory usage spike.

πŸ—‚οΈ Additional Context

The root cause is definitively tied to the system locale. If the locale is temporarily changed to English (export LANG=en_US.UTF-8) in the same terminal session, the Tab completion works perfectly, with no delay or memory issues.

This issue is shell-agnostic. It has been reproduced in both bash and zsh.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions