[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Filename completion broken for env variables

From: Bruce Hill
Subject: Filename completion broken for env variables
Date: Mon, 11 Apr 2016 19:27:07 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.7.0

Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64' -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-redhat-linux-gnu' -DCONF_VENDOR='redhat' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H -I. -I. -I./include -I./lib -D_GNU_SOURCE -DRECYCLES_PIDS -DDEFAULT_PATH_VALUE='/usr/local/bin:/usr/bin' -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic
uname output: Linux psel702 3.10.0-327.10.1.el7.x86_64 #1 SMP Sat Jan 23 
04:54:55 EST 2016 x86_64 x86_64 x86_64 GNU/Linux
Machine Type: x86_64-redhat-linux-gnu

Bash Version: 4.2
Patch Level: 46
Release Status: release

    If my path contains an env variable, instead of expanding the variable as 
in pre 4.1 bash,
    it escapes it by prepending a backslash.

    After spending several hours searching the web for a fix, I find that this 
is considered
    a new feature as filename completion ideally shouldn't change what the user 

    I suppose that would be a nice feature if it actually worked, but since the 
4.2 implementation
    does change the user input by prepending a backslash and doesn't do the 
filename completion in some
    cases like cd commands, it's just wasting the time of everyone who uses tab 
    w/ env variables and wants to figure out why after working for nearly 20 
years it's now broken.

    Here's an example.  I want to run $FOO/testApp/my_test_application so I type
    % $FOO/testApp/my_test<TAB>
    which is then replaced w/
    % \$FOO/testApp/my_test_application
    which won't run due to the prepended backslash.

    % ls $FOO/testApp/my_test<TAB>
    % ls \$FOO/testApp/my_test_application

    % cd $FOO/test<TAB>
    doesn't work at all, leaving me w/
    % cd $FOO/test

    Must set shopt direxpand, which since I work in an environment w/ a wide 
    of RHEL5, RHEL6, and RHEL7 machines supported by our IT group means I 
either need
    to convince them to update all RHEL7 machines w/ a custom version of bash 
4.3.30 or greater
    compiled w/ --enable-direxpand-default (nearly impossible in a big 
organization like ours)
    or add the following in my .bash_profile since direxpand isn't supported 
prior to bash 4.2.

# Fix annoying feature in bash 4.2 that stops expanding env vars during file 
if ((BASH_VERSINFO[0] >= 5)) || ((BASH_VERSINFO[0] == 4)) && ((BASH_VERSINFO[1] 
>= 2))
    then shopt -s direxpand

    It's really annoying to have to set a new option in order to disable a new 
feature that
    doesn't work properly.

Bruce Hill
Member Technical Staff
SLAC National Accelerator Lab
2575 Sand Hill Road M/S 10
Menlo Park, CA  94025

reply via email to

[Prev in Thread] Current Thread [Next in Thread]