Index: common.scm ================================================================== --- common.scm +++ common.scm @@ -332,11 +332,14 @@ (define (common:exit-on-version-changed) (if (common:on-homehost?) (if (common:api-changed?) (let* ((mtconf (conc (get-environment-variable "MT_RUN_AREA_HOME") "/megatest.config")) (dbfile (conc (get-environment-variable "MT_RUN_AREA_HOME") "/megatest.db")) - (read-only (not (file-write-access? dbfile))) + (read-only (or + (get-environment-variable "MT_FORCE_READONLY") + (not (file-write-access? (get-environment-variable "MT_RUN_AREA_HOME"))) + (not (file-write-access? dbfile)))) (dbstruct (db:setup #t))) (debug:print 0 *default-log-port* "WARNING: Version mismatch!\n" " expected: " (common:version-signature) "\n" " got: " (common:get-last-run-version)) Index: db.scm ================================================================== --- db.scm +++ db.scm @@ -257,11 +257,18 @@ (exn (permission)(debug:print 0 *default-log-port* "ERROR: database " fname " has some permissions problem.")) (exn () (debug:print 0 *default-log-port* "ERROR: Unknown error with database " fname " message: " ((condition-property-accessor 'exn 'message) exn)))) ))) - +(define (db:mtdbpath-writable? mtdbpath) + (let* ((parent-dir (pathname-directory mtdbpath)) + (logdir (conc parent-dir "/logs"))) + (and + (file-write-access? parent-dir) + (file-write-access? mtdbpath) + (or (not (common:file-exists? logdir)) (file-write-access? logdir)) + ))) ;; ;; This routine creates the db. It is only called if the db is not already opened ;; ;; @@ -314,11 +321,11 @@ (mtdb (db:open-megatest-db)) (mtdbpath (db:dbdat-get-path mtdb)) (tmpdb (db:open-megatest-db path: dbpath)) ;; lock-create-open dbpath db:initialize-main-db)) (refndb (db:open-megatest-db path: dbpath name: "megatest_ref.db")) - (write-access (file-write-access? mtdbpath)) + (write-access (db:mtdbpath-writable? mtdbpath)) ;; this determines if we are i readonly mode or not. (mtdbmodtime (if mtdbexists (common:lazy-sqlite-db-modification-time mtdbpath) #f)) (tmpdbmodtime (if dbfexists (common:lazy-sqlite-db-modification-time tmpdbfname) #f)) (modtimedelta (and mtdbmodtime tmpdbmodtime (- mtdbmodtime tmpdbmodtime)))) ;;(debug:print-info 13 *default-log-port* "db:open-db>> mtdbpath="mtdbpath" mtdbexists="mtdbexists" and write-access="write-access)