Fossil SCM

Look in the XDG_CONFIG_HOME environment variable before looking in HOME for the location of the ".fossil" configuration database.

drh 2020-04-18 00:12 trunk
Commit 4de54b1d98cd264cec4dcaae757dcb7e02e90093fe586deb4a12dd6081089ad3
+6 -2
--- src/db.c
+++ src/db.c
@@ -1435,17 +1435,21 @@
14351435
fossil_panic("cannot locate home directory - please set the "
14361436
"FOSSIL_HOME, LOCALAPPDATA, APPDATA, USERPROFILE, "
14371437
"or HOMEDRIVE / HOMEPATH environment variables");
14381438
}
14391439
#else
1440
+ if( zHome==0 ){
1441
+ zHome = fossil_getenv("XDG_CONFIG_HOME");
1442
+ }
14401443
if( zHome==0 ){
14411444
zHome = fossil_getenv("HOME");
14421445
}
14431446
if( zHome==0 ){
14441447
if( isOptional ) return 0;
1445
- fossil_panic("cannot locate home directory - please set the "
1446
- "FOSSIL_HOME or HOME environment variables");
1448
+ fossil_panic("cannot locate home directory - please set one of the "
1449
+ "FOSSIL_HOME, XDG_CONFIG_HOME, or HOME environment "
1450
+ "variables");
14471451
}
14481452
#endif
14491453
if( file_isdir(zHome, ExtFILE)!=1 ){
14501454
if( isOptional ) return 0;
14511455
fossil_panic("invalid home directory: %s", zHome);
14521456
--- src/db.c
+++ src/db.c
@@ -1435,17 +1435,21 @@
1435 fossil_panic("cannot locate home directory - please set the "
1436 "FOSSIL_HOME, LOCALAPPDATA, APPDATA, USERPROFILE, "
1437 "or HOMEDRIVE / HOMEPATH environment variables");
1438 }
1439 #else
 
 
 
1440 if( zHome==0 ){
1441 zHome = fossil_getenv("HOME");
1442 }
1443 if( zHome==0 ){
1444 if( isOptional ) return 0;
1445 fossil_panic("cannot locate home directory - please set the "
1446 "FOSSIL_HOME or HOME environment variables");
 
1447 }
1448 #endif
1449 if( file_isdir(zHome, ExtFILE)!=1 ){
1450 if( isOptional ) return 0;
1451 fossil_panic("invalid home directory: %s", zHome);
1452
--- src/db.c
+++ src/db.c
@@ -1435,17 +1435,21 @@
1435 fossil_panic("cannot locate home directory - please set the "
1436 "FOSSIL_HOME, LOCALAPPDATA, APPDATA, USERPROFILE, "
1437 "or HOMEDRIVE / HOMEPATH environment variables");
1438 }
1439 #else
1440 if( zHome==0 ){
1441 zHome = fossil_getenv("XDG_CONFIG_HOME");
1442 }
1443 if( zHome==0 ){
1444 zHome = fossil_getenv("HOME");
1445 }
1446 if( zHome==0 ){
1447 if( isOptional ) return 0;
1448 fossil_panic("cannot locate home directory - please set one of the "
1449 "FOSSIL_HOME, XDG_CONFIG_HOME, or HOME environment "
1450 "variables");
1451 }
1452 #endif
1453 if( file_isdir(zHome, ExtFILE)!=1 ){
1454 if( isOptional ) return 0;
1455 fossil_panic("invalid home directory: %s", zHome);
1456
+23 -19
--- www/env-opts.md
+++ www/env-opts.md
@@ -113,19 +113,21 @@
113113
114114
Environment Variables
115115
---------------------
116116
117117
On most platforms, the location of the user’s account-wide `.fossil`
118
-file is either `FOSSIL_HOME` or `HOME`, in that order. This ordering
119
-lets you put this file somewhere other than at the top of your user’s
120
-home directory by defining `FOSSIL_HOME` to mask the always-defined
121
-`HOME`.
118
+file is either `FOSSIL_HOME`, `XDG_CONFIG_HOME`, or `HOME`, in that order.
119
+This ordering lets you put this file somewhere other than at the top
120
+of your user’s home directory by defining `FOSSIL_HOME` to mask
121
+the always-defined `HOME`. The `XDG_CONFIG_HOME` setting is defined
122
+by some desktop environments to be the preferred "modern" directory
123
+in which to store configuration files.
122124
123125
For native Windows builds and for Cygwin builds, the file is called
124
-`_fossil` instead to avoid problems with old programs that assume file
125
-names cannot begin with a dot, as was true in old versions of Windows
126
-and in MS-DOS. (Newer Microsoft OSes and file systems don’t have a
126
+`_fossil` instead of `.fossil` to avoid problems with old programs that
127
+assume file names cannot begin with a dot, as was true in old versions
128
+of Windows and in MS-DOS. (Newer Microsoft OSes and file systems don’t have a
127129
problem with such files, but still we take the safe path in case you’re
128130
on a system with software that can’t cope.) We start our search with
129131
`FOSSIL_HOME` again, but instead of falling back to `HOME`, we instead
130132
try `USERPROFILE`, then `LOCALAPPDATA`, then `APPDATA`, and finally we
131133
concatenate `HOMEDRIVE` + `HOMEPATH`.
@@ -152,11 +154,12 @@
152154
153155
154156
`FOSSIL_HOME`: Location of the `~/.fossil` file. The first environment
155157
variable found in the environment from the list `FOSSIL_HOME`,
156158
`LOCALAPPDATA` (Windows), `APPDATA` (Windows), `HOMEDRIVE` and
157
-`HOMEPATH` (Windows, used together), and `HOME` is used as the
159
+`HOMEPATH` (Windows, used together), `XDG_CONFIG_HOME` (unix) and
160
+`HOME` is used as the
158161
location of the `~/.fossil` file.
159162
160163
161164
`FOSSIL_USE_SEE_TEXTKEY`: If set, treat the encryption key string for
162165
SEE as text to be hashed into the actual encryption key. This has no
@@ -198,12 +201,12 @@
198201
accordingly.
199202
200203
`HOME`: Location of the `~/.fossil` file. The first environment
201204
variable found in the environment from the list `FOSSIL_HOME`,
202205
`LOCALAPPDATA` (Windows), `APPDATA` (Windows), `HOMEDRIVE` and
203
-`HOMEPATH` (Windows, used together), and `HOME` is used as the
204
-location of the `~/.fossil` file.
206
+`HOMEPATH` (Windows, used together), `XDG_CONFIG_HOME` (unix)
207
+and `HOME` is used as the location of the `~/.fossil` file.
205208
206209
`HOMEDRIVE`, `HOMEPATH`: (Windows) Location of the `~/.fossil` file.
207210
The first environment variable found in the environment from the list
208211
`FOSSIL_HOME`, `LOCALAPPDATA` (Windows), `APPDATA` (Windows),
209212
`HOMEDRIVE` and `HOMEPATH` (Windows, used together), and `HOME` is
@@ -402,27 +405,28 @@
402405
first found environment variable from the list `FOSSIL_USER`, `USER`,
403406
`LOGNAME`, and `USERNAME`, is the user name. As a final fallback, if
404407
none of those are set, then the default user name is "root".
405408
406409
407
-### Home Directory
410
+### Configuration Directory (often the Home Directory)
408411
409412
Fossil keeps some information interesting to each user in the user's
410
-home directory. This includes the global settings and the list of
411
-repositories and checkouts used by `fossil all`.
413
+configuration file directory. This includes the global settings and the list of
414
+repositories and checkouts used by `fossil all`. On many,
415
+but not all, systems the configuration file directory is the home directory
412416
413
-The user's home directory is specified by the first environment
417
+The user's configuration file directory is specified by the first environment
414418
variable found in the environment from the list `FOSSIL_HOME`,
415419
`LOCALAPPDATA` (Windows), `APPDATA` (Windows), `HOMEDRIVE` and
416
-`HOMEPATH` (Windows, used together), and `HOME`.
420
+`HOMEPATH` (Windows, used together), `XDG_CONFIG_HOME` (unix), and `HOME`.
417421
418
-SQLite has its own notion of the user's home directory, which is only
419
-exposed if the interactive SQL shell is run with the "fossil
422
+SQLite has its own notion of the user's configuration file directory,
423
+which is only exposed if the interactive SQL shell is run with the "fossil
420424
sqlite3" command. Being a separate library, SQLite uses many of the
421425
same variables to find the home directory, but uses them in a
422
-different order, and does not use the `FOSSIL_HOME` variable at all.
423
-
426
+different order, and does not use the `FOSSIL_HOME` nor
427
+`XDG_CONFIG_HOME` variables.
424428
425429
426430
### SQLite VFS to use
427431
428432
See [the SQLite documentation](http://www.sqlite.org/vfs.html) for an
429433
--- www/env-opts.md
+++ www/env-opts.md
@@ -113,19 +113,21 @@
113
114 Environment Variables
115 ---------------------
116
117 On most platforms, the location of the user’s account-wide `.fossil`
118 file is either `FOSSIL_HOME` or `HOME`, in that order. This ordering
119 lets you put this file somewhere other than at the top of your user’s
120 home directory by defining `FOSSIL_HOME` to mask the always-defined
121 `HOME`.
 
 
122
123 For native Windows builds and for Cygwin builds, the file is called
124 `_fossil` instead to avoid problems with old programs that assume file
125 names cannot begin with a dot, as was true in old versions of Windows
126 and in MS-DOS. (Newer Microsoft OSes and file systems don’t have a
127 problem with such files, but still we take the safe path in case you’re
128 on a system with software that can’t cope.) We start our search with
129 `FOSSIL_HOME` again, but instead of falling back to `HOME`, we instead
130 try `USERPROFILE`, then `LOCALAPPDATA`, then `APPDATA`, and finally we
131 concatenate `HOMEDRIVE` + `HOMEPATH`.
@@ -152,11 +154,12 @@
152
153
154 `FOSSIL_HOME`: Location of the `~/.fossil` file. The first environment
155 variable found in the environment from the list `FOSSIL_HOME`,
156 `LOCALAPPDATA` (Windows), `APPDATA` (Windows), `HOMEDRIVE` and
157 `HOMEPATH` (Windows, used together), and `HOME` is used as the
 
158 location of the `~/.fossil` file.
159
160
161 `FOSSIL_USE_SEE_TEXTKEY`: If set, treat the encryption key string for
162 SEE as text to be hashed into the actual encryption key. This has no
@@ -198,12 +201,12 @@
198 accordingly.
199
200 `HOME`: Location of the `~/.fossil` file. The first environment
201 variable found in the environment from the list `FOSSIL_HOME`,
202 `LOCALAPPDATA` (Windows), `APPDATA` (Windows), `HOMEDRIVE` and
203 `HOMEPATH` (Windows, used together), and `HOME` is used as the
204 location of the `~/.fossil` file.
205
206 `HOMEDRIVE`, `HOMEPATH`: (Windows) Location of the `~/.fossil` file.
207 The first environment variable found in the environment from the list
208 `FOSSIL_HOME`, `LOCALAPPDATA` (Windows), `APPDATA` (Windows),
209 `HOMEDRIVE` and `HOMEPATH` (Windows, used together), and `HOME` is
@@ -402,27 +405,28 @@
402 first found environment variable from the list `FOSSIL_USER`, `USER`,
403 `LOGNAME`, and `USERNAME`, is the user name. As a final fallback, if
404 none of those are set, then the default user name is "root".
405
406
407 ### Home Directory
408
409 Fossil keeps some information interesting to each user in the user's
410 home directory. This includes the global settings and the list of
411 repositories and checkouts used by `fossil all`.
 
412
413 The user's home directory is specified by the first environment
414 variable found in the environment from the list `FOSSIL_HOME`,
415 `LOCALAPPDATA` (Windows), `APPDATA` (Windows), `HOMEDRIVE` and
416 `HOMEPATH` (Windows, used together), and `HOME`.
417
418 SQLite has its own notion of the user's home directory, which is only
419 exposed if the interactive SQL shell is run with the "fossil
420 sqlite3" command. Being a separate library, SQLite uses many of the
421 same variables to find the home directory, but uses them in a
422 different order, and does not use the `FOSSIL_HOME` variable at all.
423
424
425
426 ### SQLite VFS to use
427
428 See [the SQLite documentation](http://www.sqlite.org/vfs.html) for an
429
--- www/env-opts.md
+++ www/env-opts.md
@@ -113,19 +113,21 @@
113
114 Environment Variables
115 ---------------------
116
117 On most platforms, the location of the user’s account-wide `.fossil`
118 file is either `FOSSIL_HOME`, `XDG_CONFIG_HOME`, or `HOME`, in that order.
119 This ordering lets you put this file somewhere other than at the top
120 of your user’s home directory by defining `FOSSIL_HOME` to mask
121 the always-defined `HOME`. The `XDG_CONFIG_HOME` setting is defined
122 by some desktop environments to be the preferred "modern" directory
123 in which to store configuration files.
124
125 For native Windows builds and for Cygwin builds, the file is called
126 `_fossil` instead of `.fossil` to avoid problems with old programs that
127 assume file names cannot begin with a dot, as was true in old versions
128 of Windows and in MS-DOS. (Newer Microsoft OSes and file systems don’t have a
129 problem with such files, but still we take the safe path in case you’re
130 on a system with software that can’t cope.) We start our search with
131 `FOSSIL_HOME` again, but instead of falling back to `HOME`, we instead
132 try `USERPROFILE`, then `LOCALAPPDATA`, then `APPDATA`, and finally we
133 concatenate `HOMEDRIVE` + `HOMEPATH`.
@@ -152,11 +154,12 @@
154
155
156 `FOSSIL_HOME`: Location of the `~/.fossil` file. The first environment
157 variable found in the environment from the list `FOSSIL_HOME`,
158 `LOCALAPPDATA` (Windows), `APPDATA` (Windows), `HOMEDRIVE` and
159 `HOMEPATH` (Windows, used together), `XDG_CONFIG_HOME` (unix) and
160 `HOME` is used as the
161 location of the `~/.fossil` file.
162
163
164 `FOSSIL_USE_SEE_TEXTKEY`: If set, treat the encryption key string for
165 SEE as text to be hashed into the actual encryption key. This has no
@@ -198,12 +201,12 @@
201 accordingly.
202
203 `HOME`: Location of the `~/.fossil` file. The first environment
204 variable found in the environment from the list `FOSSIL_HOME`,
205 `LOCALAPPDATA` (Windows), `APPDATA` (Windows), `HOMEDRIVE` and
206 `HOMEPATH` (Windows, used together), `XDG_CONFIG_HOME` (unix)
207 and `HOME` is used as the location of the `~/.fossil` file.
208
209 `HOMEDRIVE`, `HOMEPATH`: (Windows) Location of the `~/.fossil` file.
210 The first environment variable found in the environment from the list
211 `FOSSIL_HOME`, `LOCALAPPDATA` (Windows), `APPDATA` (Windows),
212 `HOMEDRIVE` and `HOMEPATH` (Windows, used together), and `HOME` is
@@ -402,27 +405,28 @@
405 first found environment variable from the list `FOSSIL_USER`, `USER`,
406 `LOGNAME`, and `USERNAME`, is the user name. As a final fallback, if
407 none of those are set, then the default user name is "root".
408
409
410 ### Configuration Directory (often the Home Directory)
411
412 Fossil keeps some information interesting to each user in the user's
413 configuration file directory. This includes the global settings and the list of
414 repositories and checkouts used by `fossil all`. On many,
415 but not all, systems the configuration file directory is the home directory
416
417 The user's configuration file directory is specified by the first environment
418 variable found in the environment from the list `FOSSIL_HOME`,
419 `LOCALAPPDATA` (Windows), `APPDATA` (Windows), `HOMEDRIVE` and
420 `HOMEPATH` (Windows, used together), `XDG_CONFIG_HOME` (unix), and `HOME`.
421
422 SQLite has its own notion of the user's configuration file directory,
423 which is only exposed if the interactive SQL shell is run with the "fossil
424 sqlite3" command. Being a separate library, SQLite uses many of the
425 same variables to find the home directory, but uses them in a
426 different order, and does not use the `FOSSIL_HOME` nor
427 `XDG_CONFIG_HOME` variables.
428
429
430 ### SQLite VFS to use
431
432 See [the SQLite documentation](http://www.sqlite.org/vfs.html) for an
433
--- www/tech_overview.wiki
+++ www/tech_overview.wiki
@@ -125,17 +125,22 @@
125125
The configuration database also maintains a list of repositories. This
126126
list is used by the [/help/all | fossil all] command in order to run various
127127
operations such as "sync" or "rebuild" on all repositories managed by a user.
128128
129129
On Unix systems, the configuration database is named ".fossil" and is
130
-located in the user's home directory. On Windows, the configuration
130
+located in the user's configuration file directory, which on most older
131
+unix systems is the user's home directory but on some "desktop" linux
132
+environments is the "~/.config" directory. On Windows, the configuration
131133
database is named "_fossil" (using an underscore as the first character
132134
instead of a dot) and is located in the directory specified by the
133135
LOCALAPPDATA, APPDATA, or HOMEPATH environment variables, in that order.
136
+You can run the [/help?cmd=info|fossil info] command from an open
137
+check-out to see the location of the configuration database.
134138
135139
You can override this default location by defining the environment
136140
variable FOSSIL_HOME pointing to an appropriate (writable) directory.
141
+
137142
138143
<h3>2.2 Repository Databases</h3>
139144
140145
The repository database is the file that is commonly referred to as
141146
"the repository". This is because the repository database contains,
142147
--- www/tech_overview.wiki
+++ www/tech_overview.wiki
@@ -125,17 +125,22 @@
125 The configuration database also maintains a list of repositories. This
126 list is used by the [/help/all | fossil all] command in order to run various
127 operations such as "sync" or "rebuild" on all repositories managed by a user.
128
129 On Unix systems, the configuration database is named ".fossil" and is
130 located in the user's home directory. On Windows, the configuration
 
 
131 database is named "_fossil" (using an underscore as the first character
132 instead of a dot) and is located in the directory specified by the
133 LOCALAPPDATA, APPDATA, or HOMEPATH environment variables, in that order.
 
 
134
135 You can override this default location by defining the environment
136 variable FOSSIL_HOME pointing to an appropriate (writable) directory.
 
137
138 <h3>2.2 Repository Databases</h3>
139
140 The repository database is the file that is commonly referred to as
141 "the repository". This is because the repository database contains,
142
--- www/tech_overview.wiki
+++ www/tech_overview.wiki
@@ -125,17 +125,22 @@
125 The configuration database also maintains a list of repositories. This
126 list is used by the [/help/all | fossil all] command in order to run various
127 operations such as "sync" or "rebuild" on all repositories managed by a user.
128
129 On Unix systems, the configuration database is named ".fossil" and is
130 located in the user's configuration file directory, which on most older
131 unix systems is the user's home directory but on some "desktop" linux
132 environments is the "~/.config" directory. On Windows, the configuration
133 database is named "_fossil" (using an underscore as the first character
134 instead of a dot) and is located in the directory specified by the
135 LOCALAPPDATA, APPDATA, or HOMEPATH environment variables, in that order.
136 You can run the [/help?cmd=info|fossil info] command from an open
137 check-out to see the location of the configuration database.
138
139 You can override this default location by defining the environment
140 variable FOSSIL_HOME pointing to an appropriate (writable) directory.
141
142
143 <h3>2.2 Repository Databases</h3>
144
145 The repository database is the file that is commonly referred to as
146 "the repository". This is because the repository database contains,
147

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button