Skip to content

bash completion: tail: cannot open ‘+2’ for reading: No such file or directory #7304

Closed

Description

@finkr

When using bash completion feature, I get the error:

tail: cannot open ‘+2’ for reading: No such file or directory

The bash completion ( #6730 ) has an issue because it uses "tail +2" which isn't supported by coreutils-8.22-24.el7 (RHEL/CentOS) implementation of the command tail. The tail specification requires using using -n prefix, so use tail -n +2

Two lines should be fixed in cmd/helm/root.go:

eval $(__helm_binary_name) repo list 2>/dev/null | \tail +2 | \cut -f1
..
if out=$(eval $(__helm_binary_name) plugin list 2>/dev/null | tail +2 | cut -f1); then

As a workaround, one can load bash completion this way to patch the completion code:

 . <(helm completion bash| sed -e 's/tail +2/tail -n +2/g')

(ping @marckhouzam )

Activity

  1. marckhouzam commented on Dec 28, 2019

    @marckhouzam
    Member

    I was afraid some shell differences would start showing up to cause trouble.

    @finkr would you be interested in posting a PR?

  2. finkr commented on Dec 28, 2019

    @finkr
    ContributorAuthor

    Yes, i will

  3. marckhouzam commented on Dec 28, 2019

    @marckhouzam
    Member

    @finkr To be transparent: I'm working on a proposal that will completely remove the code affected. However your PR would still be useful for the bug releases leading up to helm 3.1 and, of course, in the case my proposal is not accepted.

  4. added
    bug
    on Dec 30, 2019
  5. marckhouzam commented on Dec 31, 2019

    @marckhouzam
    Member

    Thanks @finkr for reporting and fixing this bug!

  6. marckhouzam commented on Dec 31, 2019

    @marckhouzam
    Member

    I've created a PR to the https://github.com/helm/acceptance-testing repo to make sure completion continues to work as expected on centos: helm/acceptance-testing#67

  7. added a commit that references this issue on Jan 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions