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

gsutil ignores XDG basedir spec #991

Open
rux616 opened this issue Apr 24, 2020 · 11 comments
Open

gsutil ignores XDG basedir spec #991

rux616 opened this issue Apr 24, 2020 · 11 comments

Comments

@rux616
Copy link

rux616 commented Apr 24, 2020

Many *nix programs now adhere to the XDG Base Directory Specification. I'd love to see gsutil follow suit, or at least gain some built-in compatibility with it.

Here is the spec itself, and while I don't use Arch Linux, there's a good write-up on the wiki that explains the spec a bit more. It also has a list of programs that utilize the spec and workarounds for some of those that don't.

As it specifically relates to gsutil, it would be nice if the program checked for the configuration file in $XDG_CONFIG_HOME/gsutil/boto (defaulting back to ~/.boto), and for the state directory in $XDG_CACHE_HOME/gsutil (defaulting back to ~/.gsutil).

(I know you can set the BOTO_CONFIG environment variable to set the location of the config file, and inside said config file you can specify state_dir, but when you're running gsutil through gcloud it's not always obvious where to do that.)

@foodornt
Copy link

I just found .gsutil in my home directory I don't know what applications use it though

@CallumBaston
Copy link

This should be fixed.

@itaranto
Copy link

itaranto commented Nov 29, 2021

Guys, please fix this.

This behavior is unacceptable in 2021, please stop filling our home directories with trash.

@itaranto
Copy link

(I know you can set the BOTO_CONFIG environment variable to set the location of the config file, and inside said config file you can specify state_dir, but when you're running gsutil through gcloud it's not always obvious where to do that.)

Can you elaborate more on this? It could be useful in the meantime.

@06kellyjac
Copy link

06kellyjac commented Nov 30, 2021

Exactly as it says. You'd set BOTO_CONFIG to something e.g. ~/.config/gsutil/config

and within there you'd put state_dir = $XDG_DATA_HOME/gsutil if it accepts vars or manually put state_dir = /home/blah/.local/share/gsutil (I've used XDG_DATA_HOME since it's more appropriate for state than XDG_CACHE_HOME

# 'state_dir' specifies the base location where files that
# need a static location are stored, such as pointers to credentials,
# resumable transfer tracker files, and the last software update check.
# By default these files are stored in ~/.gsutil
#state_dir = <file_path>

Not tried it though

@josephlr
Copy link
Member

Now that gcloud storage has been promoted to GA, another workaround is to just use gcloud storage everywhere instead of gsutil. gcloud roughly follows the XDG basedir spec, storing its configuration in ~/.config/gcloud by default (can be overridden by $CLOUDSDK_CONFIG).

@lgarron
Copy link

lgarron commented Oct 19, 2022

Now that gcloud storage has been promoted to GA, another workaround is to just use gcloud storage everywhere instead of gsutil. gcloud roughly follows the XDG basedir spec, storing its configuration in ~/.config/gcloud by default (can be overridden by $CLOUDSDK_CONFIG).

I was excited to hear this!

Unfortunately, I can't find a gcloud storage equivalent to gsutil du, and https://cloud.google.com/storage/docs/getting-bucket-information still says to use gsutil du.

If anyone happens to know a way to use gcloud storage to list disk usage for a bucket, I'd be glad to hear it.

@thomasmaclean
Copy link
Contributor

Unfortunately we haven't completed gcloud storage du yet, but we're planning on starting work on very soon!

@lgarron
Copy link

lgarron commented Oct 20, 2022

Unfortunately we haven't completed gcloud storage du yet, but we're planning on starting work on very soon!

Glad to hear it! Is there a tracking issue I can follow?
(I'm eager to switch as soon as possible, if this issue won't be addressed in gsutil.)

@lgarron
Copy link

lgarron commented Dec 16, 2022

Glad to hear it! Is there a tracking issue I can follow?

poke 😀

@thomasmaclean
Copy link
Contributor

We have it scheduled for Q1, so with luck you should see it by the end of March.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants