Bug 994659 - presetting environment variable inhibits tab-completion of command
presetting environment variable inhibits tab-completion of command
Status: CLOSED RAWHIDE
Product: Fedora
Classification: Fedora
Component: bash (Show other bugs)
19
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Ondrej Oprala
Fedora Extras Quality Assurance
: FutureFeature, Reopened
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-08-07 13:45 EDT by Steve Tyler
Modified: 2016-01-31 21:09 EST (History)
7 users (show)

See Also:
Fixed In Version:
Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2014-04-01 06:29:31 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Steve Tyler 2013-08-07 13:45:31 EDT
Description of problem:
Presetting an environment variable on the command-line inhibits tab-completion of the command:

Tab-completion does not occur:
$ TZ=UTC journalct[tab]

Tab-completion occurs:
$ journalct[tab]

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=UTC journalct[tab]

Actual results:
Tab-completion does not occur.
Pressing tab has no effect.

Expected results:
The command is completed:
$ TZ=UTC journalctl
                  ^
Additional info:
The use-case is setting the time zone for the timestamps in journalctl output:
Bug 991678, Comment 21.
Comment 1 Ville Skyttä 2013-08-08 07:10:15 EDT
AFAIK there's nothing that can be done about this in bash-completion, it's a bash thing -- our completion functions simply aren't invoked in those kinds of command lines:

$ foo() { echo ; echo "in foo"; }
$ complete -F foo foo

$ foo <TAB>
in foo

$ foo=bar foo <TAB>
# filename completion occurs
Comment 2 Roman Rakus 2013-08-09 10:44:00 EDT
I'm not much familiar with bash completion, but this looks like missing feature.

I will take a look on it.
Comment 3 Steve Tyler 2013-08-09 10:55:02 EDT
Thanks, Roman.

The journalctl completions are in the systemd package, not the bash-completion package:

$ rpm -ql systemd | grep completions/journalctl
/usr/share/bash-completion/completions/journalctl
Comment 4 Ville Skyttä 2013-08-10 03:55:41 EDT
Steve BTW this has nothing to do with the bash-completion or journalctl packages or completions, see comment 1.
Comment 5 Steve Tyler 2013-08-10 04:08:41 EDT
FYI, Comment 3 was an FYI. :-)

Presumably some completions will need to be installed to test the bash fixes. Or am I mistaken? Can completions be tested without completions?
Comment 6 Ville Skyttä 2013-08-10 04:31:34 EDT
Comment 1 contains a completion for command foo, no need to install anything besides entering those two lines and start testing.
Comment 7 Steve Tyler 2013-08-10 05:50:42 EDT
Thanks for your clarification. That's very interesting. bash has a lot of features I don't know anything about ...

$ fo[tab]
fold          font2c        fonttosfnt    foo           foomatic-rip  foo.sh        for           formail       
$ foo[tab]
foo           foomatic-rip  foo.sh        
$ foo [tab]
in foo
[tab]
in foo
[enter]

in foo
$

$ complete | grep foo
complete -F foo foo
$ 
$ typeset -f foo
foo () 
{ 
    echo;
    echo "in foo"
}
$
Comment 8 Roman Rakus 2013-08-14 09:41:44 EDT
In this case the bash is trying filename completion. It could be somehow doable to learn bash (readline) to perform command completion.
Comment 9 Roman Rakus 2013-08-15 09:04:39 EDT
I'm testing bash-4.3-beta from upstream testing branch and this feature is working.
It will appear in next release of bash.
Comment 10 Steve Tyler 2013-08-15 11:04:07 EDT
What test case are you using?

$ foo() { echo ; echo "in foo"; }
$ complete -F foo foo

$ TZ=UTC fo[tab] # completion does not occur here

$ fo[tab] # this works as expected
fold          font2c        fonttosfnt    foo           foomatic-rip  foo.sh        for           formail       

$ echo $BASH_VERSION               
4.3.0(1)-beta

bash-4.3-beta.tar.gz downloaded from here:
http://git.savannah.gnu.org/cgit/bash.git/
Comment 11 Steve Tyler 2013-08-15 11:07:56 EDT
$ TZ=UTC foo[tab] # this appears to work
in foo
[enter]

in foo
$
Comment 12 Roman Rakus 2013-08-16 07:41:39 EDT
You're right.
Even worse, it only completes using programmable completions - it doesn't complete for binary files in PATH.
Comment 13 Fedora Admin XMLRPC Client 2013-10-07 07:48:02 EDT
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.
Comment 14 Ondrej Oprala 2014-04-01 06:29:31 EDT
Hi and thanks for the report.
This issue is now fixed in bash-4.3, which can be found in rawhide.

Note You need to log in before you can comment on or make changes to this bug.