Fossil SCM

Attempt to fix repolist so that it works even if the global configuration database is not available, for example when Fossil is being run inside a chroot jail with a restricted environment.

drh 2025-04-17 18:17 trunk
Commit e761c1d6f75d2eee9eaee79ad0c0f381bb4aecc686986dda8cb92382b4da8163
1 file changed +8 -5
+8 -5
--- src/repolist.c
+++ src/repolist.c
@@ -145,15 +145,18 @@
145145
char *zSkinUrl = 0; /* URL for the skin database */
146146
int bShowDesc = 0; /* True to show the description column */
147147
int bShowLg = 0; /* True to show the login-group column */
148148
149149
assert( g.db==0 );
150
- db_open_config(1, 0);
151
- bShowDesc = (0!=db_int(0, "SELECT value FROM global_config"
152
- " WHERE name='show-repolist-desc'"));
153
- bShowLg = (0!=db_int(0, "SELECT value FROM global_config"
154
- " WHERE name='show-repolist-lg'"));
150
+ if( db_open_config(1, 1)
151
+ && db_table_exists("configdb", "global_config")
152
+ ){
153
+ bShowDesc = (0!=db_int(0, "SELECT value FROM global_config"
154
+ " WHERE name='show-repolist-desc'"));
155
+ bShowLg = (0!=db_int(0, "SELECT value FROM global_config"
156
+ " WHERE name='show-repolist-lg'"));
157
+ }
155158
blob_init(&html, 0, 0);
156159
if( fossil_strcmp(g.zRepositoryName,"/")==0 && !g.fJail ){
157160
/* For the special case of the "repository directory" being "/",
158161
** show all of the repositories named in the ~/.fossil database.
159162
**
160163
--- src/repolist.c
+++ src/repolist.c
@@ -145,15 +145,18 @@
145 char *zSkinUrl = 0; /* URL for the skin database */
146 int bShowDesc = 0; /* True to show the description column */
147 int bShowLg = 0; /* True to show the login-group column */
148
149 assert( g.db==0 );
150 db_open_config(1, 0);
151 bShowDesc = (0!=db_int(0, "SELECT value FROM global_config"
152 " WHERE name='show-repolist-desc'"));
153 bShowLg = (0!=db_int(0, "SELECT value FROM global_config"
154 " WHERE name='show-repolist-lg'"));
 
 
 
155 blob_init(&html, 0, 0);
156 if( fossil_strcmp(g.zRepositoryName,"/")==0 && !g.fJail ){
157 /* For the special case of the "repository directory" being "/",
158 ** show all of the repositories named in the ~/.fossil database.
159 **
160
--- src/repolist.c
+++ src/repolist.c
@@ -145,15 +145,18 @@
145 char *zSkinUrl = 0; /* URL for the skin database */
146 int bShowDesc = 0; /* True to show the description column */
147 int bShowLg = 0; /* True to show the login-group column */
148
149 assert( g.db==0 );
150 if( db_open_config(1, 1)
151 && db_table_exists("configdb", "global_config")
152 ){
153 bShowDesc = (0!=db_int(0, "SELECT value FROM global_config"
154 " WHERE name='show-repolist-desc'"));
155 bShowLg = (0!=db_int(0, "SELECT value FROM global_config"
156 " WHERE name='show-repolist-lg'"));
157 }
158 blob_init(&html, 0, 0);
159 if( fossil_strcmp(g.zRepositoryName,"/")==0 && !g.fJail ){
160 /* For the special case of the "repository directory" being "/",
161 ** show all of the repositories named in the ~/.fossil database.
162 **
163

Keyboard Shortcuts

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