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

Support the XDG Base Directory Specification. #1734

Open
Earnestly opened this Issue Jun 19, 2015 · 16 comments

Comments

Projects
None yet
@Earnestly

Earnestly commented Jun 19, 2015

This is a continuation from the previous (#148) pull request which your bot apparently merged, but in effect did not.

As there is no open issue about this, I've decided to open one so it is publicly known.

Much has been said in the previous pull request so I won't repeat it here.

For reference, here is a non-exhaustive list of software with varying degrees of compliance.

@0X1A

This comment has been minimized.

Show comment
Hide comment
@0X1A

0X1A Jun 25, 2015

Have been stumped by this as well. Looked for Cargo's config in ~/.config/cargo only to find nothing. Don't really understand why Cargo places its config in ~/.cargo and the environment variable
CARGO_HOME, while nice is entirely useless. If the user's XDG is not set then it would be fine to place in ~/.cargo.

0X1A commented Jun 25, 2015

Have been stumped by this as well. Looked for Cargo's config in ~/.config/cargo only to find nothing. Don't really understand why Cargo places its config in ~/.cargo and the environment variable
CARGO_HOME, while nice is entirely useless. If the user's XDG is not set then it would be fine to place in ~/.cargo.

@Earnestly

This comment has been minimized.

Show comment
Hide comment
@Earnestly

Earnestly Jun 25, 2015

@0X1A If the respective XDG_* variables are not set, they should fallback
to the appropriate defaults as defined by the specification. The unfortunate
legacy behaviour cargo needlessly introduced will likely just add the code
bloat.

Earnestly commented Jun 25, 2015

@0X1A If the respective XDG_* variables are not set, they should fallback
to the appropriate defaults as defined by the specification. The unfortunate
legacy behaviour cargo needlessly introduced will likely just add the code
bloat.

@Yamakaky

This comment has been minimized.

Show comment
Hide comment
@Yamakaky

Yamakaky Sep 6, 2015

Is someone working on this ? The more we wait, the more difficult it will be to change the default.

Yamakaky commented Sep 6, 2015

Is someone working on this ? The more we wait, the more difficult it will be to change the default.

@0X1A

This comment has been minimized.

Show comment
Hide comment
@0X1A

0X1A Sep 6, 2015

@Yamakaky AFAIK there isn't anything being done about it

0X1A commented Sep 6, 2015

@Yamakaky AFAIK there isn't anything being done about it

@whitequark

This comment has been minimized.

Show comment
Hide comment
@whitequark

whitequark Sep 21, 2015

Contributor

You can use my xdg crate to implement this.

Contributor

whitequark commented Sep 21, 2015

You can use my xdg crate to implement this.

tbu- added a commit to tbu-/cargo that referenced this issue Nov 10, 2015

Make Cargo XDG-compliant (on non-Windows systems)
http://standards.freedesktop.org/basedir-spec/basedir-spec-0.8.html
http://www.freedesktop.org/software/systemd/man/file-hierarchy.html

Strategy for backward-compatiblity:

When checking for the relevant cargo directories, check in the following
order of preference:

1) Use the environment variable `CARGO_HOME`.
2) Use the XDG directories if they exist.
3) Use the legacy location (~/.cargo) if it exists.
4) Fall back the XDG directories if everything else fails.

Fixes #1734.

tbu- added a commit to tbu-/cargo that referenced this issue Nov 10, 2015

Make Cargo XDG-compliant (on non-Windows systems)
http://standards.freedesktop.org/basedir-spec/basedir-spec-0.8.html
http://www.freedesktop.org/software/systemd/man/file-hierarchy.html

Strategy for backward-compatiblity:

When checking for the relevant cargo directories, check in the following
order of preference:

1) Use the environment variable `CARGO_HOME`.
2) Use the XDG directories if they exist.
3) Use the legacy location (~/.cargo) if it exists.
4) Fall back the XDG directories if everything else fails.

Fixes #1734.
@nagisa

This comment has been minimized.

Show comment
Hide comment
@nagisa

nagisa Dec 11, 2015

cargo install now installs into ~/.cargo/bin.

nagisa commented Dec 11, 2015

cargo install now installs into ~/.cargo/bin.

@whitequark

This comment has been minimized.

Show comment
Hide comment
@whitequark

whitequark Dec 11, 2015

Contributor

... and it really should use ~/.local/bin; there's precedent already in the behavior pip install --user, at least.

Contributor

whitequark commented Dec 11, 2015

... and it really should use ~/.local/bin; there's precedent already in the behavior pip install --user, at least.

tbu- added a commit to tbu-/cargo that referenced this issue Dec 18, 2015

Make Cargo obey platform-specific directory standards
Strategy for backward-compatiblity:

When checking for the relevant Cargo directories, check in the following
order of preference:

1) Use the environment variable `CARGO_HOME`.
2) Use the platform-specific directories if they exist.
3) Use the legacy location (~/.cargo) if it exists.
4) Fall back to the platform-specific directories if everything else fails.

The new platform-specific directories are as follows:

On Windows, use `AppData\Local\Temp\Cargo` for cache files (obtained via
`GetTempPath`), `AppData\Roaming\Cargo` for the config files
(`FOLDERID_RoamingAppData`) and `AppData\Local\Programs\Cargo` for
installed binaries (`FOLDERID_UserProgramFiles`).

On Unixy systems, use the XDG spec: `~/.cache/cargo` for cache files,
`~/.config/cargo` for config, `~/.local/bin` for installed binaries.

http://standards.freedesktop.org/basedir-spec/basedir-spec-0.8.html
http://www.freedesktop.org/software/systemd/man/file-hierarchy.html

On OS X, use `~/Library/Caches/Cargo` for cache files, `~/Library/Cargo`
for config files and `~/Library/Cargo/bin` for binary files.

Fixes #1734. Fixes #1976.

tbu- added a commit to tbu-/cargo that referenced this issue Dec 26, 2015

Make Cargo obey platform-specific directory standards
Strategy for backward-compatiblity:

When checking for the relevant Cargo directories, check in the following
order of preference:

1) Use the environment variable `CARGO_HOME`.
2) Use the platform-specific directories if they exist.
3) Use the legacy location (~/.cargo) if it exists.
4) Fall back to the platform-specific directories if everything else fails.

The new platform-specific directories are as follows:

On Windows, use `AppData\Local\Temp\Cargo` for cache files (obtained via
`GetTempPath`), `AppData\Roaming\Cargo` for the config files
(`FOLDERID_RoamingAppData`) and `AppData\Local\Programs\Cargo` for
installed binaries (`FOLDERID_UserProgramFiles`).

On Unixy systems, use the XDG spec: `~/.cache/cargo` for cache files,
`~/.config/cargo` for config, `~/.local/bin` for installed binaries.

http://standards.freedesktop.org/basedir-spec/basedir-spec-0.8.html
http://www.freedesktop.org/software/systemd/man/file-hierarchy.html

On OS X, use `~/Library/Caches/Cargo` for cache files, `~/Library/Cargo`
for config files and `~/Library/Cargo/bin` for binary files.

Fixes #1734. Fixes #1976.

tbu- added a commit to tbu-/cargo that referenced this issue Jan 25, 2016

Make Cargo obey platform-specific directory standards
Strategy for backward-compatiblity:

When checking for the relevant Cargo directories, check in the following
order of preference:

1) Use the environment variable `CARGO_HOME`.
2) Use the platform-specific directories if they exist.
3) Use the legacy location (~/.cargo) if it exists.
4) Fall back to the platform-specific directories if everything else fails.

The new platform-specific directories are as follows:

On Windows, use `AppData\Local\Temp\Cargo` for cache files (obtained via
`GetTempPath`), `AppData\Roaming\Cargo` for the config files
(`FOLDERID_RoamingAppData`) and `AppData\Local\Programs\Cargo` for
installed binaries (`FOLDERID_UserProgramFiles`).

On Unixy systems, use the XDG spec: `~/.cache/cargo` for cache files,
`~/.config/cargo` for config, `~/.local/bin` for installed binaries.

http://standards.freedesktop.org/basedir-spec/basedir-spec-0.8.html
http://www.freedesktop.org/software/systemd/man/file-hierarchy.html

On OS X, use `~/Library/Caches/Cargo` for cache files, `~/Library/Cargo`
for config files and `~/Library/Cargo/bin` for binary files.

Fixes #1734. Fixes #1976.

tbu- added a commit to tbu-/cargo that referenced this issue Jan 25, 2016

Make Cargo obey platform-specific directory standards
Strategy for backward-compatiblity:

When checking for the relevant Cargo directories, check in the following
order of preference:

1) Use the environment variable `CARGO_HOME`.
2) Use the platform-specific directories if they exist.
3) Use the legacy location (~/.cargo) if it exists.
4) Fall back to the platform-specific directories if everything else fails.

The new platform-specific directories are as follows:

On Windows, use `AppData\Local\Temp\Cargo` for cache files (obtained via
`GetTempPath`), `AppData\Roaming\Cargo` for the config files
(`FOLDERID_RoamingAppData`) and `AppData\Local\Programs\Cargo` for
installed binaries (`FOLDERID_UserProgramFiles`).

On Unixy systems, use the XDG spec: `~/.cache/cargo` for cache files,
`~/.config/cargo` for config, `~/.local/bin` for installed binaries.

http://standards.freedesktop.org/basedir-spec/basedir-spec-0.8.html
http://www.freedesktop.org/software/systemd/man/file-hierarchy.html

On OS X, use `~/Library/Caches/Cargo` for cache files, `~/Library/Cargo`
for config files and `~/Library/Cargo/bin` for binary files.

Fixes #1734. Fixes #1976.
@Stebalien

This comment has been minimized.

Show comment
Hide comment
@Stebalien

Stebalien Jul 31, 2016

Contributor

@tbu- any progress?

Contributor

Stebalien commented Jul 31, 2016

@tbu- any progress?

@tbu-

This comment has been minimized.

Show comment
Hide comment
@tbu-

tbu- Jul 31, 2016

Contributor
Contributor

tbu- commented Jul 31, 2016

@Abdillah

This comment has been minimized.

Show comment
Hide comment
@Abdillah

Abdillah Oct 8, 2016

It's the only thing I missed in rust ecosystem!
Maybe we can rebase the patch to keep it synced with current development.

Or to separate the patch into three platform so that it will be available on partial inclusion.

Abdillah commented Oct 8, 2016

It's the only thing I missed in rust ecosystem!
Maybe we can rebase the patch to keep it synced with current development.

Or to separate the patch into three platform so that it will be available on partial inclusion.

@tbu-

This comment has been minimized.

Show comment
Hide comment
@tbu-

tbu- Oct 8, 2016

Contributor

I'll rebase the patch or the partial patch if this gets accepted. This won't be the problem.

Contributor

tbu- commented Oct 8, 2016

I'll rebase the patch or the partial patch if this gets accepted. This won't be the problem.

@sanmai-NL

This comment has been minimized.

Show comment
Hide comment
@sanmai-NL

sanmai-NL Feb 22, 2018

I don’t know where this came from, but on Linux I apparently have both

  • CARGO_HOME being ~/.cargo/bin/ as well as
  • CARGO_HOME2 being ~/.cargo/bin/bin/ . 😕

sanmai-NL commented Feb 22, 2018

I don’t know where this came from, but on Linux I apparently have both

  • CARGO_HOME being ~/.cargo/bin/ as well as
  • CARGO_HOME2 being ~/.cargo/bin/bin/ . 😕
@genodeftest

This comment has been minimized.

Show comment
Hide comment
@genodeftest

genodeftest Feb 24, 2018

@sanmai-NL Where does your CARGO_HOME2 come from? I only have CARGO_HOME, which I set to "$XDG_DATA_HOME"/cargo in my ~/.bashrc.

genodeftest commented Feb 24, 2018

@sanmai-NL Where does your CARGO_HOME2 come from? I only have CARGO_HOME, which I set to "$XDG_DATA_HOME"/cargo in my ~/.bashrc.

@sanmai-NL

This comment has been minimized.

Show comment
Hide comment
@sanmai-NL

sanmai-NL Feb 24, 2018

I have no idea, probably just some leftover from messing around when there was no Arch Linux package for Cargo yet. Note that my CARGO_HOME was also wrong, the bin path component should only be appended to CARGO_HOME within the PATH env var instead.

sanmai-NL commented Feb 24, 2018

I have no idea, probably just some leftover from messing around when there was no Arch Linux package for Cargo yet. Note that my CARGO_HOME was also wrong, the bin path component should only be appended to CARGO_HOME within the PATH env var instead.

@Glandos

This comment has been minimized.

Show comment
Hide comment
@Glandos

Glandos Mar 10, 2018

Another issue with not respecting XDG: backups. My current backup profiles knows that it should avoid ~/.cache/ directory. And cargo is creating a lot of things into ~/.cargo that is only cache data, not useful to backup…

Glandos commented Mar 10, 2018

Another issue with not respecting XDG: backups. My current backup profiles knows that it should avoid ~/.cache/ directory. And cargo is creating a lot of things into ~/.cargo that is only cache data, not useful to backup…

soc added a commit to soc/cargo that referenced this issue Mar 15, 2018

[WIP] Add support for platform-defined standard directories
This change stops cargo from violating the operating system rules
regarding the placement of config, cache, ... directories on Linux,
macOS and Windows.

Existing directories and overrides are retained.

The precedence is as follows:

1) use the `CARGO_HOME` environment variable if it exists (legacy)
2) use `CARGO_CACHE_DIR`, `CARGO_CONFIG_DIR` etc. env vars if they exist
3) use the ~/.cargo directory if it exists (legacy)
4) follow operating system standards

Fixes:
  rust-lang#1734
  rust-lang#1976
  rust-lang/rust#12725

Addresses:
  rust-lang/rfcs#1615
  rust-lang#148,
  rust-lang#3981

soc added a commit to soc/cargo that referenced this issue Mar 15, 2018

[WIP] Add support for platform-defined standard directories
This change stops cargo from violating the operating system rules
regarding the placement of config, cache, ... directories on Linux,
macOS and Windows.

Existing directories and overrides are retained.

The precedence is as follows:

1) use the `CARGO_HOME` environment variable if it exists (legacy)
2) use `CARGO_CACHE_DIR`, `CARGO_CONFIG_DIR` etc. env vars if they exist
3) use the ~/.cargo directory if it exists (legacy)
4) follow operating system standards

Fixes:
  rust-lang#1734
  rust-lang#1976
  rust-lang/rust#12725

Addresses:
  rust-lang/rfcs#1615
  rust-lang#148,
  rust-lang#3981

soc added a commit to soc/cargo that referenced this issue Mar 15, 2018

[WIP] Add support for platform-defined standard directories
This change stops cargo from violating the operating system rules
regarding the placement of config, cache, ... directories on Linux,
macOS and Windows.

Existing directories and overrides are retained.

The precedence is as follows:

1) use the `CARGO_HOME` environment variable if it exists (legacy)
2) use `CARGO_CACHE_DIR`, `CARGO_CONFIG_DIR` etc. env vars if they exist
3) use the ~/.cargo directory if it exists (legacy)
4) follow operating system standards

Fixes:
  rust-lang#1734
  rust-lang#1976
  rust-lang/rust#12725

Addresses:
  rust-lang/rfcs#1615
  rust-lang#148,
  rust-lang#3981

@soc soc referenced a pull request that will close this issue Mar 15, 2018

Open

Support platform-defined standard directories #5183

soc added a commit to soc/cargo that referenced this issue Mar 15, 2018

[WIP] Add support for platform-defined standard directories
This change stops cargo from violating the operating system rules
regarding the placement of config, cache, ... directories on Linux,
macOS and Windows.

Existing directories and overrides are retained.

The precedence is as follows:

1) use the `CARGO_HOME` environment variable if it exists (legacy)
2) use `CARGO_CACHE_DIR`, `CARGO_CONFIG_DIR` etc. env vars if they exist
3) use the ~/.cargo directory if it exists (legacy)
4) follow operating system standards

Fixes:
  rust-lang#1734
  rust-lang#1976
  rust-lang/rust#12725

Addresses:
  rust-lang/rfcs#1615
  rust-lang#148,
  rust-lang#3981

soc added a commit to soc/cargo that referenced this issue Mar 15, 2018

[WIP] Add support for platform-defined standard directories
This change stops cargo from violating the operating system rules
regarding the placement of config, cache, ... directories on Linux,
macOS and Windows.

Existing directories and overrides are retained.

The precedence is as follows:

1) use the `CARGO_HOME` environment variable if it exists (legacy)
2) use `CARGO_CACHE_DIR`, `CARGO_CONFIG_DIR` etc. env vars if they exist
3) use the ~/.cargo directory if it exists (legacy)
4) follow operating system standards

A new cargo command, `dirs`,  is added, which can provide path
information to other command line tools.

Fixes:
  rust-lang#1734
  rust-lang#1976
  rust-lang/rust#12725

Addresses:
  rust-lang/rfcs#1615
  rust-lang#148,
  rust-lang#3981

soc added a commit to soc/cargo that referenced this issue Mar 15, 2018

[WIP] Add support for platform-defined standard directories
This change stops cargo from violating the operating system rules
regarding the placement of config, cache, ... directories on Linux,
macOS and Windows.

Existing directories and overrides are retained.

The precedence is as follows:

1) use the `CARGO_HOME` environment variable if it exists (legacy)
2) use `CARGO_CACHE_DIR`, `CARGO_CONFIG_DIR` etc. env vars if they exist
3) use the ~/.cargo directory if it exists (legacy)
4) follow operating system standards

A new cargo command, `dirs`,  is added, which can provide path
information to other command line tools.

Fixes:
  rust-lang#1734
  rust-lang#1976
  rust-lang/rust#12725

Addresses:
  rust-lang/rfcs#1615
  rust-lang#148,
  rust-lang#3981

soc added a commit to soc/cargo that referenced this issue Mar 15, 2018

[WIP] Add support for platform-defined standard directories
This change stops cargo from violating the operating system rules
regarding the placement of config, cache, ... directories on Linux,
macOS and Windows.

Existing directories and overrides are retained.

The precedence is as follows:

1) use the `CARGO_HOME` environment variable if it exists (legacy)
2) use `CARGO_CACHE_DIR`, `CARGO_CONFIG_DIR` etc. env vars if they exist
3) use the ~/.cargo directory if it exists (legacy)
4) follow operating system standards

A new cargo command, `dirs`,  is added, which can provide path
information to other command line tools.

Fixes:
  rust-lang#1734
  rust-lang#1976
  rust-lang/rust#12725

Addresses:
  rust-lang/rfcs#1615
  rust-lang#148,
  rust-lang#3981

soc added a commit to soc/cargo that referenced this issue Mar 18, 2018

[WIP] Add support for platform-defined standard directories
This change stops cargo from violating the operating system rules
regarding the placement of config, cache, ... directories on Linux,
macOS and Windows.

Existing directories and overrides are retained.

The precedence is as follows:

1) use the `CARGO_HOME` environment variable if it exists (legacy)
2) use `CARGO_CACHE_DIR`, `CARGO_CONFIG_DIR` etc. env vars if they exist
3) use the ~/.cargo directory if it exists (legacy)
4) follow operating system standards

A new cargo command, `dirs`,  is added, which can provide path
information to other command line tools.

Fixes:
  rust-lang#1734
  rust-lang#1976
  rust-lang/rust#12725

Addresses:
  rust-lang/rfcs#1615
  rust-lang#148,
  rust-lang#3981
@Eh2406

This comment has been minimized.

Show comment
Hide comment
@Eh2406
Contributor

Eh2406 commented Mar 28, 2018

soc added a commit to soc/cargo that referenced this issue Apr 11, 2018

Add support for platform-defined standard directories
This change stops cargo from violating the operating system rules
regarding the placement of config, cache, ... directories on Linux,
macOS and Windows.

Existing directories and overrides are retained.

The precedence is as follows:

1) use the `CARGO_HOME` environment variable if it exists (legacy)
2) use `CARGO_CACHE_DIR`, `CARGO_CONFIG_DIR` etc. env vars if they exist
3) use the ~/.cargo directory if it exists (legacy)
4) follow operating system standards

A new cargo command, `dirs`,  is added, which can provide path
information to other command line tools.

Fixes:
  rust-lang#1734
  rust-lang#1976
  rust-lang/rust#12725

Addresses:
  rust-lang/rfcs#1615
  rust-lang#148,
  rust-lang#3981

soc added a commit to soc/cargo that referenced this issue Apr 11, 2018

Add support for platform-defined standard directories
This change stops cargo from violating the operating system rules
regarding the placement of config, cache, ... directories on Linux,
macOS and Windows.

Existing directories and overrides are retained.

The precedence is as follows:

1) use the `CARGO_HOME` environment variable if it exists (legacy)
2) use `CARGO_CACHE_DIR`, `CARGO_CONFIG_DIR` etc. env vars if they exist
3) use the ~/.cargo directory if it exists (legacy)
4) follow operating system standards

A new cargo command, `dirs`,  is added, which can provide path
information to other command line tools.

Fixes:
  rust-lang#1734
  rust-lang#1976
  rust-lang/rust#12725

Addresses:
  rust-lang/rfcs#1615
  rust-lang#148,
  rust-lang#3981

soc added a commit to soc/cargo that referenced this issue Apr 28, 2018

Add support for platform-defined standard directories
This change stops cargo from violating the operating system rules
regarding the placement of config, cache, ... directories on Linux,
macOS and Windows.

Existing directories and overrides are retained.

The precedence is as follows:

1) use the `CARGO_HOME` environment variable if it exists (legacy)
2) use `CARGO_CACHE_DIR`, `CARGO_CONFIG_DIR` etc. env vars if they exist
3) use the ~/.cargo directory if it exists (legacy)
4) follow operating system standards

A new cargo command, `dirs`,  is added, which can provide path
information to other command line tools.

Fixes:
  rust-lang#1734
  rust-lang#1976
  rust-lang/rust#12725

Addresses:
  rust-lang/rfcs#1615
  rust-lang#148,
  rust-lang#3981
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment