Fossil SCM

Attempt to augment the "attempt to write a readonly database" error from Fossil by listing all databases it is using that are read-only.

drh 2025-08-03 22:47 trunk
Commit 0ea8703b60c604d768efcdc27786cf470245f8ad04e1964fd5f5770aa5eb3b29
1 file changed +10
+10
--- src/db.c
+++ src/db.c
@@ -125,10 +125,20 @@
125125
#endif /* FOSSIL_ENABLE_JSON */
126126
if( g.xferPanic && g.cgiOutput==1 ){
127127
cgi_reset_content();
128128
@ error Database\serror:\s%F(z)
129129
cgi_reply();
130
+ }
131
+ if( strstr(z,"attempt to write a readonly database") ){
132
+ static const char *azDbNames[] = { "repository", "localdb", "configdb" };
133
+ int i;
134
+ for(i=0; i<3; i++){
135
+ if( sqlite3_db_readonly(g.db, azDbNames[i])==1 ){
136
+ z = mprintf("\"%s\" is readonly.\n%s",
137
+ sqlite3_db_filename(g.db,azDbNames[i]), z);
138
+ }
139
+ }
130140
}
131141
fossil_fatal("Database error: %s", z);
132142
}
133143
134144
/*
135145
--- src/db.c
+++ src/db.c
@@ -125,10 +125,20 @@
125 #endif /* FOSSIL_ENABLE_JSON */
126 if( g.xferPanic && g.cgiOutput==1 ){
127 cgi_reset_content();
128 @ error Database\serror:\s%F(z)
129 cgi_reply();
 
 
 
 
 
 
 
 
 
 
130 }
131 fossil_fatal("Database error: %s", z);
132 }
133
134 /*
135
--- src/db.c
+++ src/db.c
@@ -125,10 +125,20 @@
125 #endif /* FOSSIL_ENABLE_JSON */
126 if( g.xferPanic && g.cgiOutput==1 ){
127 cgi_reset_content();
128 @ error Database\serror:\s%F(z)
129 cgi_reply();
130 }
131 if( strstr(z,"attempt to write a readonly database") ){
132 static const char *azDbNames[] = { "repository", "localdb", "configdb" };
133 int i;
134 for(i=0; i<3; i++){
135 if( sqlite3_db_readonly(g.db, azDbNames[i])==1 ){
136 z = mprintf("\"%s\" is readonly.\n%s",
137 sqlite3_db_filename(g.db,azDbNames[i]), z);
138 }
139 }
140 }
141 fossil_fatal("Database error: %s", z);
142 }
143
144 /*
145

Keyboard Shortcuts

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