From 27376c60a9b870e7ba456551165897a7408b5886 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Tue, 28 Mar 2023 10:17:14 +0200 Subject: Allow deriving the current user's home directory via the HOME variable This patch hails from Git for Windows (where the Cygwin runtime is used in the form of a slightly modified MSYS2 runtime), where it is a well-established technique to let the `$HOME` variable define where the current user's home directory is, falling back to `$HOMEDRIVE$HOMEPATH` and `$USERPROFILE`. The idea is that we want to share user-specific settings between programs, whether they be Cygwin, MSYS2 or not. Unfortunately, we cannot blindly activate the "db_home: windows" setting because in some setups, the user's home directory is set to a hidden directory via an UNC path (\\share\some\hidden\folder$) -- something many programs cannot handle correctly, e.g. `cmd.exe` and other native Windows applications that users want to employ as Git helpers. The established technique is to allow setting the user's home directory via the environment variables mentioned above: `$HOMEDRIVE$HOMEPATH` or `$USERPROFILE`. This has the additional advantage that it is much faster than querying the Windows user database. Of course this scheme needs to be opt-in. For that reason, it needs to be activated explicitly via `db_home: env` in `/etc/nsswitch.conf`. Signed-off-by: Johannes Schindelin --- winsup/doc/ntsec.xml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'winsup/doc') diff --git a/winsup/doc/ntsec.xml b/winsup/doc/ntsec.xml index c6871ec..1678ff6 100644 --- a/winsup/doc/ntsec.xml +++ b/winsup/doc/ntsec.xml @@ -1203,6 +1203,17 @@ schemata are the following: See for a more detailed description. + + env + Derives the home directory of the current user from the + environment variable HOME (falling back to + HOMEDRIVE\HOMEPATH and + USERPROFILE, in that order). This is faster + than the windows schema at the + expense of determining only the current user's home directory + correctly. This schema is skipped for any other account. + + @@ -1336,6 +1347,17 @@ of each schema when used with db_home: for a detailed description. + env + Derives the home directory of the current user from the + environment variable HOME (falling back to + HOMEDRIVE\HOMEPATH and + USERPROFILE, in that order). This is faster + than the windows schema at the + expense of determining only the current user's home directory + correctly. This schema is skipped for any other account. + + + @ad_attribute AD only: The user's home directory is set to the path given in the ad_attribute attribute. The path -- cgit v1.1