Description of problem: Attempting tab-completion with the TZ environment variable results in a list of files and directories, not a list of time zones: $ TZ=[tab] bar.dir/ foo.txt NB: TZ is a POSIX environment variable: 8. Environment Variables http://pubs.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap08.html Version-Release number of selected component (if applicable): bash-completion-2.1-2.fc19.noarch bash-4.2.45-1.fc19.x86_64 How reproducible: Always. Steps to Reproduce: 1. $ TZ=[tab] Actual results: A list of files and directories is displayed: $ TZ=[tab] bar.dir/ foo.txt Expected results: A list of time zones is displayed. Additional info: With zsh, a list of time zones is displayed: % TZ=[tab] Africa/ CST6CDT GMT Israel NZ ROK America/ Cuba GMT0 Jamaica NZ-CHAT Singapore Antarctica/ EET GMT-0 Japan Pacific/ Turkey Arctic/ Egypt GMT+0 Kwajalein Poland UCT Asia/ Eire Greenwich Libya Portugal Universal Atlantic/ EST Hongkong MET posix/ US/ Australia/ EST5EDT HST Mexico/ posixrules UTC Brazil/ Etc/ Iceland Mideast/ PRC WET Canada/ Europe/ Indian/ MST PST8PDT W-SU CET GB Iran MST7MDT right/ zone.tab Chile/ GB-Eire iso3166.tab Navajo ROC Zulu zsh-5.0.2-4.fc19.x86_64
Completing the first argument is not something that can be done with bash's programmable completion features as far as I know. On the other hand, for export and friends (at least env, declare, typeset) it can be done, and is now done for export upstream: http://anonscm.debian.org/gitweb/?p=bash-completion/bash-completion.git;a=commitdiff;h=3f144beb721525821136f76f53a3147b4688d331
Your upstream patch looks like it _fixes_ this bug. Why did you close it CANTFIX instead of UPSTREAM?
Because as said, the requested feature cannot AFAIK be implemented. The upstream patch implements "export TZ=<TAB>" completion, not plain "TZ=<TAB>" which is what was requested.
Thanks for the clarification. The upstream version doesn't appear to work with: $ export TZ=[tab] That returns a list of files and directories, not a list of time zones. To test the upstream version, do I need to do anything in addition to these? 1. Copy upstream version of bash_completion into /usr/share/bash-completion/: $ ls /usr/share/bash-completion/ bash_completion bash_completion.ORIG completions/ helpers/ $ rpm -V bash-completion SM5..UGT. /usr/share/bash-completion/bash_completion 2. Log out. 3. Log in.
You need updated completions/export in /usr/share/bash-completion/completions from upstream too.
Verified. Thanks for the patch. $ export TZ=U[tab] UCT Universal US/ UTC $ export TZ=UTC ;date Thu Aug 8 11:51:50 UTC 2013 $ rpm -V bash-completion SM5..UGT. /usr/share/bash-completion/bash_completion SM5..UGT. /usr/share/bash-completion/completions/export BTW, I didn't know tab-completion requires so much infrastructure: $ rpm -ql bash-completion | wc -l 563
(In reply to Steve Tyler from comment #6) > $ rpm -ql bash-completion | wc -l > 563 We could (and used to) lump everything into just a couple of files, but since version 2.0 splitting most things into per command completion files allows us to dynamically load needed functions from them on demand which allows huge shell startup time savings.
That sounds like a valuable optimization: $ rpm -ql bash-completion | grep /usr/share/bash-completion/ | xargs cat 2>/dev/null | wc -l 81051
The pipeline in Comment 8 follows links and omits completions from other packages. FWIW, here is a better line count: $ find /usr/share/bash-completion/ -type f | xargs cat | wc -l 29839 That's still a lot of lines ...