Gsutil: Tab complete fails with zsh

Created on 25 Oct 2016  路  14Comments  路  Source: GoogleCloudPlatform/gsutil

I'm using gsutil with zsh.

When I type:

gsutil cp path/to/local-fil<tab>

I see a "..." for tab completion for a fairly long time (maybe 3-5 seconds) and then no completion, even if there's a valid completion available.

I have the following in my .zshrc:

# The next line updates PATH for the Google Cloud SDK.
source '/Users/danvk/google-cloud-sdk/path.zsh.inc'

# The next line enables shell command completion for gcloud.
source '/Users/danvk/google-cloud-sdk/completion.zsh.inc'

I'm on gcloud 131.0.0 and:

$ gsutil --version
gsutil version: 4.21

Most helpful comment

I have the same issue on MacOs (zsh is now default) with Google Cloud SDK 304.0.0. Tab completion seems to do something for a few seconds but does not complete.

All 14 comments

I'm having exactly the same problem with gsutil version 4.22 (gcloud 133.0.0). gcloud itself autocompletes fine.

Thanks for the report - we've identified an issue in the zsh tab completion include file, and hope to follow up with a gcloud fix.

This should hopefully be fixed in gcloud 140.0.0 when it releases.

I am running Google Cloud SDK 141.0.0 and gsutil 4.22.
Seems this issue still not fixed?

Thanks for the report; I reached out to the gcloud folks.

5 months and still no fix? Google??

Sorry for letting this fall off the radar! We've reached out to the gcloud team again about prioritizing this.

Just an update that the gcloud team got back to me, and I'm investigating further, given their findings.

I traced this back to a change in the gcloud SDK code where they stopped including their third_party libraries in the PYTHONPATH environment variable. As such, gsutil isn't able to import the argcomplete module, and abandons the attempt at tab completion.

I've let the gcloud folks know, so I'll provide an update after they get back to me.

Now that the above commit has been pushed, this should be fixed when we release v4.26. I've tested it myself with both zsh and Bash.

I seem to be having this issue with gsutil 4.31. What information can I provide that would be most helpful?

I've have had this issue pop up again too, although mine isn't showing the "..."s its just not finding any autocomplete options. Any pointers for where to start looking?

gsutil version: 4.33
OSX: 10.13.5 (17F77)
zsh 5.5.1 (x86_64-apple-darwin17.5.0)

Well, I can only think of a couple things off the top of my head that might cause this:

  • A new gsutil version (or the version of argcomplete being bundled with gsutil) may have broken this.
  • A new version of the Cloud SDK (specifically, of the <cloud-sdk-root>/completion.zsh.inc file) may have broken this... although, the last update to this file that I can find was in late May of 2017.

Since the Cloud SDK comes bundled with a specific gsutil component for each release, you should be able to install various different versions of the Cloud SDK (I'd recommend taking the binary search approach) to figure out the version of the Cloud SDK at which this started happening.

It also looks like someone reported a similar issue on the Cloud SDK IssueTracker component; you may want to check that out or file a separate issue:
https://issuetracker.google.com/issues/111661398

I have the same issue on MacOs (zsh is now default) with Google Cloud SDK 304.0.0. Tab completion seems to do something for a few seconds but does not complete.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

codefrau picture codefrau  路  31Comments

chris-crucible picture chris-crucible  路  12Comments

jdfoote picture jdfoote  路  18Comments

almirb picture almirb  路  16Comments

hhh151671 picture hhh151671  路  15Comments