Fossil

Check-in [0ea8703b60]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Attempt to augment the "attempt to write a readonly database" error from Fossil by listing all databases it is using that are read-only.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 0ea8703b60c604d768efcdc27786cf470245f8ad04e1964fd5f5770aa5eb3b29
User & Date: drh 2025-08-03 22:47:44.407
Context
2025-08-04
23:58
Add a NULL check where a change from [4c3e1728e1b1a9cb] inadvertently changed the semantics from NULL=="" to NULL==NULL, triggering a null pointer deref via backlinks parsing. Triggered by rebuild when encountering a tag with no value. check-in: 441264b759 user: stephan tags: trunk
2025-08-03
22:47
Attempt to augment the "attempt to write a readonly database" error from Fossil by listing all databases it is using that are read-only. check-in: 0ea8703b60 user: drh tags: trunk
11:31
Eliminate a superfluous allocation and have freepass() zero out its storage to avoid a duplicate free() in the very off chance that it's ever called twice. These are cleanups made in passing, not fixing known problems. check-in: 1c9d5cd81d user: stephan tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/db.c.
123
124
125
126
127
128
129










130
131
132
133
134
135
136
  }
  else
#endif /* FOSSIL_ENABLE_JSON */
  if( g.xferPanic && g.cgiOutput==1 ){
    cgi_reset_content();
    @ error Database\serror:\s%F(z)
    cgi_reply();










  }
  fossil_fatal("Database error: %s", z);
}

/*
** Check a result code.  If it is not SQLITE_OK, print the
** corresponding error message and exit.







>
>
>
>
>
>
>
>
>
>







123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
  }
  else
#endif /* FOSSIL_ENABLE_JSON */
  if( g.xferPanic && g.cgiOutput==1 ){
    cgi_reset_content();
    @ error Database\serror:\s%F(z)
    cgi_reply();
  }
  if( strstr(z,"attempt to write a readonly database") ){
    static const char *azDbNames[] = { "repository", "localdb", "configdb" };
    int i;
    for(i=0; i<3; i++){
      if( sqlite3_db_readonly(g.db, azDbNames[i])==1 ){
        z = mprintf("\"%s\" is readonly.\n%s", 
                     sqlite3_db_filename(g.db,azDbNames[i]), z);
      }
    }
  }
  fossil_fatal("Database error: %s", z);
}

/*
** Check a result code.  If it is not SQLITE_OK, print the
** corresponding error message and exit.