Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Krew immediately fails after installation under Macos Big Sur #683

Closed
goafabric opened this issue Jan 14, 2021 · 21 comments
Closed

Krew immediately fails after installation under Macos Big Sur #683

goafabric opened this issue Jan 14, 2021 · 21 comments
Labels
good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/bug Categorizes issue or PR as related to a bug. lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. priority/P3 P3 issues or PRs

Comments

@goafabric
Copy link

Following this Process:
https://krew.sigs.k8s.io/docs/user-guide/setup/install/

Krew just fails directliy with:
0114 13:48:16.421460 7059 root.go:79] failed to retrieve plugin indexes: failed to list the remote URL for index .DS_Store: command execution failure, output="": fork/exec /usr/local/bin/git: not a directory

Envirnomnet:

  • Macos Big Sur
  • zsh

git is accessible , as well as in the path, as also in /usr/local/bin

@goafabric
Copy link
Author

Ok the problem seems to be that Macos as always likes to create .DS_Store Folders . .which is a common thing
After krew update there will also be on inside .krew/index .. and than everything fails.
Manually removing the .DS_Store solves the issue temp. until the next update ..

@chriskim06
Copy link
Member

Interesting, I'll try to investigate this weekend after upgrading to big sur. Thanks for doing some digging and filing this issue!

@ahmetb
Copy link
Member

ahmetb commented Jan 14, 2021

I had Krew installed prior to updating to Big Sur, and I'm not observing this.

I can repro this by doing touch ~/.krew/index/foo followed by kubectl krew update.

@chriskim06 it sounds like we need to Walk only directories under $KREW_ROOT/index but we currently aren't. There's probably no situation we should consider non-dir entries as index candidates.

@ahmetb
Copy link
Member

ahmetb commented Jan 14, 2021

Although I must note that a clean install under Big Sur didn't result in this error.
@goafabric I'm suspecting you might've opened ~/.krew directory or its subdirectories in Finder.app once? (Though, even that didn't create the issue for me.)

@chriskim06
Copy link
Member

I think we are only walking directories now that I'm taking a closer look https://github.com/kubernetes-sigs/krew/blob/master/internal/index/indexoperations/index.go#L38-L58. We use ioutil.ReadDir which according to the docs:

ReadDir reads the directory named by dirname and returns a list of directory entries sorted by filename.

@ahmetb
Copy link
Member

ahmetb commented Jan 14, 2021

@chriskim06 yeah that returns all entries (it's a readdir syscall).

@ahmetb
Copy link
Member

ahmetb commented Jan 14, 2021

/kind bug
/priority p3
/help-wanted
/good-first-issue

@k8s-ci-robot
Copy link
Contributor

@ahmetb:
This request has been marked as suitable for new contributors.

Please ensure the request meets the requirements listed here.

If this request no longer meets these requirements, the label can be removed
by commenting with the /remove-good-first-issue command.

In response to this:

/kind bug
/priority p3
/help-wanted
/good-first-issue

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added kind/bug Categorizes issue or PR as related to a bug. priority/P3 P3 issues or PRs good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. labels Jan 14, 2021
@chriskim06
Copy link
Member

Oh ya makes sense, I misread the doc thinking it meant it only reads "entries that are directories" instead of "the entries in the directory"

@goafabric
Copy link
Author

Interesting, I'll try to investigate this weekend after upgrading to big sur. Thanks for doing some digging and filing this issue!

thanks for the quick reply

@wikimix
Copy link

wikimix commented Mar 4, 2021

I resolved the issue as follow :

  • Delete the folder ~/.krew
  • reinstall Krew

And it works !

@lauchokyip
Copy link
Contributor

lauchokyip commented Mar 15, 2021

@chriskim06 @ahmetb
Hi, I would like to try but I need some more inputs to get started :)

So based on this comment (#683 (comment)) should I read the directory only and ignore all the files and assign them into the index over here?

indexes := []Index{}
for _, dir := range dirs {
indexName := dir.Name()
remote, err := gitutil.GetRemoteURL(paths.IndexPath(indexName))
if err != nil {
return nil, errors.Wrapf(err, "failed to list the remote URL for index %s", indexName)
}
indexes = append(indexes, Index{
Name: indexName,
URL: remote,
})

Thank You

@lauchokyip
Copy link
Contributor

/assign

@chriskim06
Copy link
Member

This function looks in the index folder for the various indexes that a user has, which are just git repos cloned into that directory. I think the original problem was that there was a .DS_store file or folder (I'm not super well versed in macOS stuff) in that folder. If that's a file then I think adding something like

if !dir.IsDir() {
    continue
}

would be enough (and probably changing the name of that variable). It would be good to include this regardless though since as Ahmet mentioned:

There's probably no situation we should consider non-dir entries as index candidates

If .DS_Store is a folder then it'll be a bit more work to handle the error when the folder isn't a git repo.

@lauchokyip
Copy link
Contributor

lauchokyip commented Mar 15, 2021

Hey @chriskim06. Gotcha, thank you for your quick response! Hopefully to submit a PR by today. Thank You!

@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jul 10, 2021
@spirosoik
Copy link

is this still open? can I have a look?

@lauchokyip
Copy link
Contributor

lauchokyip commented Aug 9, 2021 via email

@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle rotten

@k8s-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Sep 8, 2021
@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Reopen this issue or PR with /reopen
  • Mark this issue or PR as fresh with /remove-lifecycle rotten
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/close

@k8s-ci-robot
Copy link
Contributor

@k8s-triage-robot: Closing this issue.

In response to this:

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Reopen this issue or PR with /reopen
  • Mark this issue or PR as fresh with /remove-lifecycle rotten
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/bug Categorizes issue or PR as related to a bug. lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. priority/P3 P3 issues or PRs
Projects
None yet
Development

No branches or pull requests

9 participants