Bash directory name completion is different in 13.2

opensuse v13.2
bash 4.2.53

Bash directory name completion is different in 13.2, and not in a good way. There is something unusual about the alii for “ls”.

In .bashrc:

LS_OPTIONS="--literal --color --tabsize=0 --classify"
alias ls="/bin/ls `echo $LS_OPTIONS`"
alias del="rm"
alias ll="ls -lh"

When I enter a partial directory name and hit TAB, I expect the directory name to be completed. Because I have ‘–classify’, the name has a trailing “/”. I like it like that. Now, though, sometimes it does not do that; instead it puts a space after the name rather than the slash, or removes backslashes and quotes.

If I type (<TAB> is the TAB key to auto-complete)
ll 1\ r<TAB>
I get
ll 1 rk forms-front folder
instead of
ll 1\ rk\ forms-front\ folder/

If, however I type
/bin/ls --literal --color --tabsize=0 --classify 1\ r<TAB>
I get
/bin/ls --literal --color --tabsize=0 --classify 1\ rk\ forms-front\ folder/

Also, if I do this:
ll “1 rk forms-front folder”<ENTER>
it works as expected, directory listing.

If I do this instead:
ll “1 rk forms-front folder”<TAB>
I get
ll 1 rk forms-front folder

If I type:
/bin/ls --literal --color --tabsize=0 --classify “1 rk forms-front folder”<TAB>
I get
/bin/ls --literal --color --tabsize=0 --classify 1\ rk\ forms-front\ folder/

I do not understand why there is a difference.
Or how to correct it.

Ok i have 13.2 installed here but i can’t seem to find that alias.

grep -i ls_options ~/.bashrc

grep -i ll ~/.bashrc

grep -i del ~/.bashrc

grep -i ll ~/.bashrc

and

grep -i ls_options /etc/skel/.bashrc

grep -i ll  /etc/skell/.bashrc

grep -i del  /etc/skel/.bashrc

grep -i ll /etc/skel/.bashrc

Checking the value of those aliases

type -a del ll ls
-bash: type: del: not found
ll is aliased to `ls -l'
ls is aliased to `_ls'
ls is /usr/bin/ls
ls is /bin/ls
ls is /usr/bin/X11/ls

Also checking /etc for the value of LS_OPTIONS

echo "$LS_OPTIONS"
-A -N --color=tty -T 0
find /etc -type -exec grep -i ls_options {} +

So is this your own aliases and variable that works for the previous openSUSE version?

Also why the echo and command substitution?

alias ls="/bin/ls `echo $LS_OPTIONS`"

Without those hack simply adding the options to /bin/ls will do.

alias ls="/bin/ls $LS_OPTIONS"

[QUOTE=jetchisel;2678289]Ok i have 13.2 installed here but i can’t seem to find that alias.

find /etc -type -exec grep -i ls_options {} +

Sorry it should be, with the f so find will not complain :slight_smile:

find /etc -type f -exec grep -i ls_options {} +

So is this your own aliases and variable that works for the previous openSUSE version?

Yes, and it worked until the upgrade to 13.2.

I have done some more research, here it is.

I have pasted the 13.2 complete.bash in paste.opensuse.org

http://paste.opensuse.org/view/raw/24031469

Now on your 13.2 install compare the output of that link using diff and curl.

diff /etc/profile.d/complete.bash <(curl -Lsf http://paste.opensuse.org/view/raw/24031469)
echo $?

If zero is the output that means the file matches. (Actually diff will print something on your terminal if the file is not identical.)

Here is the complete.bash on 13.1

http://paste.opensuse.org/view/raw/91567219

If you can get your hands (or if you still have a 13.1 install) compare the complete.bash to that url

diff /etc/profile.d/complete.bash <(curl -Lsf http://paste.opensuse.org/view/raw/91567219)
echo $?

Again if zero is the output that means it that file is identical.

Now compare those 2 files and you will see if there has been some changes between the 2.
You can put those url in a variable or you can use curl directly on that url.

thirteen_point_two='http://paste.opensuse.org/view/raw/24031469'
thirteen_point_one='http://paste.opensuse.org/view/raw/91567219'

diff <(curl -Lsf "$thirteen_point_one) <(curl -Lsf "$thirteen_point_two)

And the output is

681a682,685
>       local -i init=$(grep -c _init_completion "${dir}/${cmd}" 2>/dev/null)
>       if ((init > 0)) && ! type -t _init_completion &> /dev/null ; then
>           complete -o default -o bashdefault "${cmd}" &>/dev/null && return 124
>       fi

Which means that there has been some changes in the complete.bash file in 13.2. ( diff output from both file.)

and complete.bash belongs to the package aaa_base-extras which you can get from

rpm -qf /etc/profile.d/complete.bash

That is all what i can tell since i’m not a fan of completion to begin with ( i’m fine with the default ).

Thank you for the discussion about bash completion. I have gotten the same results as you have shown.

I do not think that is the issue, though. I have what should be two identical methods of completing a directory name based on the “alias” function. Yet the result is NOT the same.

The directory name is "1 rk forms-front folder".

LS_OPTIONS="--literal --color --tabsize=0 --classify"
alias ls="/bin/ls $LS_OPTIONS" 
alias ll="ls -lh"

ls 1\ r<TAB>
yields
ls 1\ rk\ forms-front\ folder/

ll 1\ r<TAB>
yields
ll 1 rk forms-front folder

The result using "ls ..." and "ll ..." should have been the same with the "ls" result the desired one.

I have also tried

LL_OPTIONS="--literal --color --tabsize=0 --classify -lh"
alias ll="/bin/ls $LL_OPTIONS"

to get a single alias-ing. It gives the same undesirable result.

FYI,

I tried your aliases in a 13.2 vm and it works as what you would expect (ie your desired result) so maybe some other aliases that is messing with your tab completion.

type -a ll ls 
ll is aliased to `ls -lh'
ls is aliased to `/bin/ls --literal --color --tabsize=0 --classify'
ls is /usr/bin/ls
ls is /bin/ls

is what i have, if you’re running an X server you might have more results.

I tried your aliases in a 13.2 vm and it works as what you would expect (ie your desired result) so maybe some other aliases that is messing with your tab completion.

Well, yes. That was my assumption.

The question has been: What is doing the messing?

$ type -a ll ls
ll is aliased to `/usr/bin/ls --literal --color --tabsize=0 --classify -lh'
ls is aliased to `/usr/bin/ls --literal --color --tabsize=0 --classify'
ls is /usr/bin/ls
ls is /bin/ls
ls is /usr/bin/X11/ls

$ ll /bin/ls
lrwxrwxrwx 1 root root 11 Nov 14 21:17 /bin/ls -> /usr/bin/ls*
$ ll /usr/bin/ls
-rwxr-xr-x 1 root root 112K Oct 15 08:35 /usr/bin/ls*
$ ll /usr/bin/X11/ls
-rwxr-xr-x 1 root root 112K Oct 15 08:35 /usr/bin/X11/ls*

$ diff /usr/bin/ls /usr/bin/X11/ls
$