Your message dated Tue, 4 Dec 2018 22:43:08 -0200
with message-id <[email protected]>
and subject line Re: bash-completion: files are missing from list of candidate 
filenames after  tar zcvf
has caused the Debian Bug report #619548,
regarding bash-completion: files are missing from list of candidate filenames 
after tar zcvf
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
619548: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=619548
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: bash-completion
Version: 1:1.2-3
Severity: normal

NOTE: The attached /etc/bash_completion.d/tar fixes the bug by
commenting out the code which invokes the _tar function.
The bug exists when working with the /etc/bash_completion.d/tar file
installed by the package.

The bug is that when I start a 'tar zcvf tarfile.tgz ' command and want
to add filenames by tab-completing as much as possible, some files do
not appear in the lists of candidate files.  So I have to type out the
full filename rather than do tab-completion on that filename.

I saw the bug also in Debian Lenny and fixed it there the same way.

-- System Information:
Debian Release: 6.0.1
  APT prefers squeeze-updates
  APT policy: (500, 'squeeze-updates'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.32-5-vserver-amd64 (SMP w/8 CPU cores)
Locale: LANG=en_US.utf8, LC_CTYPE=en_US.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages bash-completion depends on:
ii  bash                          4.1-3      The GNU Bourne Again SHell

bash-completion recommends no packages.

bash-completion suggests no packages.

-- Configuration Files:
/etc/bash_completion.d/tar changed:
have tar && {
_tar()
{
    local cur ext regex tar untar
    COMPREPLY=()
    _get_comp_words_by_ref cur
    if [ $COMP_CWORD -eq 1 ]; then
        COMPREPLY=( $( compgen -W 'c t x u r d A' -- "$cur" ) )
        return 0
    fi
    case ${COMP_WORDS[1]} in
    ?(-)[cr]*f)
        _filedir
        return 0
        ;;
    +([^IZzJjy])f)
        ext='t@(ar?(.@(Z|gz|bz?(2)|lz?(ma)|xz))|gz|bz?(2)|lz?(ma)|xz)'
        regex='t\(ar\(\.\(Z\|gz\|bz2\?\|lzma\|xz\)\)\?\|gz\|bz2\?\|lzma\|xz\)'
        ;;
    *[Zz]*f)
        ext='t?(ar.)@(gz|Z)'
        regex='t\(ar\.\)\?\(gz\|Z\)'
        ;;
    *[Ijy]*f)
        ext='t?(ar.)bz?(2)'
        regex='t\(ar\.\)\?bz2\?'
        ;;
    *[J]*f)
        ext='t?(ar.)@(lz?(ma)|xz)'
        regex='t\(ar\.\)\?\(lzma\|xz\)\?'
        ;;
    *)
        _filedir
        return 0
        ;;
    esac
    if [[ "$COMP_LINE" == *$ext' ' ]]; then
        # complete on files in tar file
        #
        # get name of tar file from command line
        tar=$( sed -e 's/^.* \([^ ]*'$regex'\) .*$/\1/' <<<"$COMP_LINE" )
        # devise how to untar and list it
        untar=t${COMP_WORDS[1]//[^Izjyf]/}
        COMPREPLY=( $( compgen -W "$( printf '%s ' $( tar $untar $tar \
            2>/dev/null ) )" -- "$cur" ) )
        return 0
    fi
    # file completion on relevant files
    _filedir "$ext"
    return 0
}
}


-- no debconf information



--- End Message ---
--- Begin Message ---
On Fri, 25 Mar 2011 00:04:51 +0200 Omer Zak <[email protected]> wrote:
> Package: bash-completion
> Version: 1:1.2-3
> Severity: normal
> 
> NOTE: The attached /etc/bash_completion.d/tar fixes the bug by
> commenting out the code which invokes the _tar function.
> The bug exists when working with the /etc/bash_completion.d/tar file
> installed by the package.

Compared to the tar file from version 1.2-3, the attached patch removes
the lines that install the completion for tar, i.e.:

-[ -n "${COMP_TAR_INTERNAL_PATHS:-}" ] && complete -F _tar -o dirnames tar ||
-    complete -F _tar -o filenames tar

Thus, it makes completion fallback to bash's default completion.

> The bug is that when I start a 'tar zcvf tarfile.tgz ' command and want
> to add filenames by tab-completing as much as possible, some files do
> not appear in the lists of candidate files.  So I have to type out the
> full filename rather than do tab-completion on that filename.

I gave it a try with current sources and it works as designed:

  $ ls
  archive1.tgz  file1  file2  file3

  $ tar zvcf [TAB]
  (no output)
  (expected, because we don't suggest adding to an existing archive)

  $ tar zvcf archive2.tgz [TAB]
  archive1.tgz  file1         file2         file3

  $ tar zvcf archive2.tgz file1 [TAB]
  archive1.tgz  file1         file2         file3

  $ $ tar zvcf archive2.tgz file1 file2 [TAB]
  archive1.tgz  file1         file2         file3

and so on...

I'm closing the bug report as it doesn't reproduce with current sources
(it would be too much trouble now, after so many years, to try and find
the version that fixed it).  Please, do not hesitate to reopen if you
have more information.

Cheers,
Gabriel

--- End Message ---

Reply via email to