Results 1 to 10 of 10

Thread: Bash directory name completion is different in 13.2

  1. #1

    Default 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:
    Code:
    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.

  2. #2

    Default Re: Bash directory name completion is different in 13.2

    Quote Originally Posted by jimoe666 View Post
    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:
    Code:
    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.

    Code:
    grep -i ls_options ~/.bashrc
    
    grep -i ll ~/.bashrc
    
    grep -i del ~/.bashrc
    
    grep -i ll ~/.bashrc

    and

    Code:
    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
    Code:
    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

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

    So is this your own aliases and variable that works for the previous openSUSE version?
    "Unfortunately time is always against us" -- [Morpheus]

    .:https://github.com/Jetchisel:.

  3. #3

    Default Re: Bash directory name completion is different in 13.2

    Also why the echo and command substitution?

    Code:
    alias ls="/bin/ls `echo $LS_OPTIONS`"
    Without those hack simply adding the options to /bin/ls will do.

    Code:
    alias ls="/bin/ls $LS_OPTIONS"
    "Unfortunately time is always against us" -- [Morpheus]

    .:https://github.com/Jetchisel:.

  4. #4

    Default Re: Bash directory name completion is different in 13.2

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


    Code:
    find /etc -type -exec grep -i ls_options {} +
    Sorry it should be, with the f so find will not complain

    Code:
    find /etc -type f -exec grep -i ls_options {} +
    "Unfortunately time is always against us" -- [Morpheus]

    .:https://github.com/Jetchisel:.

  5. #5

    Default Re: Bash directory name completion is different in 13.2

    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.

  6. #6

    Default Re: Bash directory name completion is different in 13.2

    I have done some more research, here it is.

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

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

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

    Code:
    diff /etc/profile.d/complete.bash <(curl -Lsf http://paste.opensuse.org/view/raw/24031469)
    Code:
    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
    Code:
    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

    Code:
    diff /etc/profile.d/complete.bash <(curl -Lsf http://paste.opensuse.org/view/raw/91567219)
    Code:
    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.

    Code:
    thirteen_point_two='http://paste.opensuse.org/view/raw/24031469'
    thirteen_point_one='http://paste.opensuse.org/view/raw/91567219'
    Code:
    diff <(curl -Lsf "$thirteen_point_one) <(curl -Lsf "$thirteen_point_two)
    And the output is

    Code:
    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
    Code:
    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 ).
    "Unfortunately time is always against us" -- [Morpheus]

    .:https://github.com/Jetchisel:.

  7. #7

    Default Re: Bash directory name completion is different in 13.2

    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.

    Code:
    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.

  8. #8

    Default Re: Bash directory name completion is different in 13.2

    I have also tried
    Code:
    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.

  9. #9

    Default Re: Bash directory name completion is different in 13.2

    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.

    Code:
    type -a ll ls
    Code:
    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.
    "Unfortunately time is always against us" -- [Morpheus]

    .:https://github.com/Jetchisel:.

  10. #10

    Default Re: Bash directory name completion is different in 13.2

    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?

    Code:
    $ 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
    $

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •