Megatest

Check-in [4153c0f183]
Login
Overview
Comment:wip
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | v1.64-ro
Files: files | file ages | folders
SHA1: 4153c0f1830b8aef3381df91e6db3c23d97aaff6
User & Date: bjbarcla on 2017-11-29 15:14:19
Other Links: branch diff | manifest | tags
Context
2017-11-29
15:14
wip Leaf check-in: 4153c0f183 user: bjbarcla tags: v1.64-ro
12:00
changed readonly mode check to include unwritable mtra dir and unwritable mtra/logs dir check-in: f3d24ced62 user: bjbarcla tags: v1.64-ro
Changes

Modified db.scm from [cdffa82ac9] to [30f0478d92].

254
255
256
257
258
259
260
261

262
263
264
265
266
267
268


269
270
271
272
273
274
275
254
255
256
257
258
259
260

261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277







-
+







+
+







         (exn (io-error)  (debug:print 0 *default-log-port* "ERROR: i/o error with " fname ". Check permissions, disk space etc. and try again."))
         (exn (corrupt)   (debug:print 0 *default-log-port* "ERROR: database " fname " is corrupt. Repair it to proceed."))
         (exn (busy)      (debug:print 0 *default-log-port* "ERROR: database " fname " is locked. Try copying to another location, remove original and copy back."))
         (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))))
	)))


;; this routine is used to determine if we are in write mode or read-only mode
(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))
     (or (not (configf:lookup *configdat* "setup" "write-requires-ownership"))
         (equal? (file-owner mtdbpath)(current-effective-user-id)))
     )))



;; ;; This routine creates the db. It is only called if the db is not already opened
;; ;; 
;; (define (db:open-rundb dbstruct run-id #!key (attemptnum 0)(do-not-open #f)) ;;  (conc *toppath* "/megatest.db") (car *configinfo*)))
385
386
387
388
389
390
391
392

393
394
395
396
397
398
399
387
388
389
390
391
392
393

394
395
396
397
398
399
400
401







-
+







         (dbpath       (conc  dbdir "/" (or name "megatest.db")))
	 (dbexists     (common:file-exists? dbpath))
	 (db           (db:lock-create-open dbpath
					    (lambda (db)
                                              (db:initialize-main-db db)
					      ;;(db:initialize-run-id-db db)
					      )))
	 (write-access (file-write-access? dbpath)))
	 (write-access (db:mtdbpath-writable? dbpath)))
    (debug:print-info 13 *default-log-port* "db:open-megatest-db "dbpath)
    (if (and dbexists (not write-access))
	(set! *db-write-access* #f))
    (cons db dbpath)))

;; sync run to disk if touched
;;