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

RFC: installation paths and runtime paths #12725

Closed
o11c opened this issue Mar 6, 2014 · 5 comments
Closed

RFC: installation paths and runtime paths #12725

o11c opened this issue Mar 6, 2014 · 5 comments

Comments

@o11c
Copy link

o11c commented Mar 6, 2014

The directories I am describing is not new; it is only a collection of existing standard practices.

Current practice

Currently, common practice is to install rust packages into ~/.rust. This is unfriendly, since you're adding a junk dir in the middle of someone else's home, and there are better places (mostly ~/.local/lib/rust, but do keep reading).

Installation variables

These are often embedded into the application at configure-time (unlike DESTDIR, which must not be, since it is only for use of packaging tools).

variable default purpose
PREFIX /usr/local architecture-independent files (/usr for distros)
EPREFIX ${PREFIX} architecture-dependent files
BINDIR ${EPREFIX}/bin user executables (${PREFIX}/games for games)
SBINDIR ${EPREFIX}/sbin system admin executables
LIBEXECDIR ${EPREFIX}/libexec program executables
SYSCONFDIR ${PREFIX}/etc read-only single-machine data (/etc for distros)
LOCALSTATEDIR ${PREFIX}/var modifiable single-machine data (/var for distros)
LIBDIR ${EPREFIX}/lib object code libraries
DATAROOTDIR ${PREFIX}/share read-only arch.-independent data root
DATADIR ${DATAROOTDIR} read-only architecture-independent data (${PREFIX}/share/games for games) (should only use ${DATADIR}/${PACKAGE}/)
LOCALEDIR ${DATAROOTDIR}/locale locale-dependent data
DOCDIR ${DATAROOTDIR}/doc/${PACKAGE} documentation root

Working in ${HOME}

(XDG; this applies even if you were installed globally)

variable default purpose
XDG_DATA_HOME $HOME/.local/share dir to read/write user data
XDG_DATA_DIRS /usr/local/share/:/usr/share/ dirs to read data after that (should include ${DATADIR} if you change that)
XDG_CONFIG_HOME $HOME/.config dir to read/write user config
XDG_CONFIG_DIRS /etc/xdg dirs to read config after that
XDG_CACHE_HOME $HOME/.cache dir to read/write nonessential temporary files
XDG_RUNTIME_DIR None (supposed to be set by session manager, often unavailable) private (0700) dir for sockets and named pipes

(To encourage the development of well-behaved software, some helper functions should be put in one of the standard libraries)

Practical installation into ${HOME}

variable default
PREFIX ${HOME}/.local
BINDIR ${HOME}/bin
DATADIR ${XDG_DATA_HOME}
SBINDIR hopeless
SYSCONFDIR ${XDG_CONFIG_HOME}
LOCALSTATEDIR if an application needs this, it probably can't be installed as user. However, ${LOCALSTATEDIR}/cache is vaguely similar to ${XDG_CACHE_HOME} and ${LOCALSTATEDIR}/run is vaguely similar to ${XDG_RUNTIME_DIR}
@emberian
Copy link
Member

emberian commented Mar 6, 2014

This is awesome information to have. But, what is actionable that we should change right now, if anything? Does rustc need to take any of these into account, or just packaging tools?

@emberian
Copy link
Member

emberian commented Mar 6, 2014

(cc @thestinger)

@lucab
Copy link
Contributor

lucab commented Mar 7, 2014

@cmr this is something mostly for the new-to-come package manager. However, some parts also impact rustc (eg. LIBDIR) and should be taken into account when touching other stuff like rpaths (#11746).

@huonw
Copy link
Member

huonw commented Mar 18, 2014

cc @wycats @carlhuda @carllerche

@steveklabnik
Copy link
Member

Closing, as the issue on the Cargo repo covers this.

soc added a commit to soc/cargo that referenced this issue Mar 15, 2018
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
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
flip1995 pushed a commit to flip1995/rust that referenced this issue May 2, 2024
…xyas

configurably allow `useless_vec` in tests

This adds a `àllow-useless-vec-in-test` configuration which, when set to `true` will allow the `useless_vec` lint in `#[test]` functions and code within `#[cfg(test)]`. It also moves a `is_in_test` helper to `clippy_utils`.

---

changelog: configurably allow [`useless_vec`] in test code
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

5 participants