aboutsummaryrefslogtreecommitdiff
path: root/winsup/doc
diff options
context:
space:
mode:
authorJohannes Schindelin <johannes.schindelin@gmx.de>2023-03-28 10:17:14 +0200
committerCorinna Vinschen <corinna@vinschen.de>2023-03-28 12:18:14 +0200
commit27376c60a9b870e7ba456551165897a7408b5886 (patch)
tree5b04ff2a43c51419dd0b4928c82a2dd99116d8d9 /winsup/doc
parentfc6e89c937c1bcdf2b0efc6806e29960c448b756 (diff)
downloadnewlib-27376c60a9b870e7ba456551165897a7408b5886.zip
newlib-27376c60a9b870e7ba456551165897a7408b5886.tar.gz
newlib-27376c60a9b870e7ba456551165897a7408b5886.tar.bz2
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 <johannes.schindelin@gmx.de>
Diffstat (limited to 'winsup/doc')
-rw-r--r--winsup/doc/ntsec.xml22
1 files changed, 22 insertions, 0 deletions
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 <xref linkend="ntsec-mapping-nsswitch-desc"></xref>
for a more detailed description.</listitem>
</varlistentry>
+ <varlistentry>
+ <term><literal>env</literal></term>
+ <listitem>Derives the home directory of the current user from the
+ environment variable <literal>HOME</literal> (falling back to
+ <literal>HOMEDRIVE\HOMEPATH</literal> and
+ <literal>USERPROFILE</literal>, in that order). This is faster
+ than the <term><literal>windows</literal></term> schema at the
+ expense of determining only the current user's home directory
+ correctly. This schema is skipped for any other account.
+ </listitem>
+ </varlistentry>
</variablelist>
<para>
@@ -1336,6 +1347,17 @@ of each schema when used with <literal>db_home:</literal>
for a detailed description.</listitem>
</varlistentry>
<varlistentry>
+ <term><literal>env</literal></term>
+ <listitem>Derives the home directory of the current user from the
+ environment variable <literal>HOME</literal> (falling back to
+ <literal>HOMEDRIVE\HOMEPATH</literal> and
+ <literal>USERPROFILE</literal>, in that order). This is faster
+ than the <term><literal>windows</literal></term> schema at the
+ expense of determining only the current user's home directory
+ correctly. This schema is skipped for any other account.
+ </listitem>
+ </varlistentry>
+ <varlistentry>
<term><literal>@ad_attribute</literal></term>
<listitem>AD only: The user's home directory is set to the path given
in the <literal>ad_attribute</literal> attribute. The path