[racket-dev] Fwd: [plt] Push #27935: master branch updated

From: Ryan Culpepper (ryan at cs.utah.edu)
Date: Mon Dec 16 23:34:00 EST 2013

Matthew has requested this commit be included in the release branch.

It looks safe to me, but I can't tell if it fixes the problem in all 
cases. A more obvious, if coarser, fix would be something like

(define (file->connection file [write? #f])
   (unless (file-exists? file)
     (create-and-initialize ....))
   (connect ....))

Let's take the commit below in the interest of moving forward, and if 
Matthew wants to change it again later we can take that commit too.


-------- Original Message --------
Subject: [plt] Push #27935: master branch updated
Date: Mon, 16 Dec 2013 20:51:58 -0500
From: mflatt at racket-lang.org
To: dev at racket-lang.org

mflatt has updated `master' from ac480e7535 to 6ff7359212.

=====[ One Commit ]=====================================================
Directory summary:
  100.0% pkgs/racket-pkgs/racket-index/setup/


6ff7359 Matthew Flatt <mflatt at racket-lang.org> 2013-12-16 18:19
| raco setup: create docindex database before trying to read
| Commit 0f80c71fab propagates read-only mode so that a documentation
| database is not created for read operations, but `raco setup` (with
| documentation-index support) attempts to read the database before
| writing to it. Change `raco setup` to make sure the database
| exists if a later write operation is expected to create it.
| Merge bug fix to v6.0 (pending review)
   M pkgs/racket-pkgs/racket-index/setup/scribble.rkt | 18 

=====[ Overall Diff ]===================================================

--- OLD/pkgs/racket-pkgs/racket-index/setup/scribble.rkt
+++ NEW/pkgs/racket-pkgs/racket-index/setup/scribble.rkt
@@ -223,6 +223,20 @@
    (define main-doc-exists? (ormap (lambda (d) (member 'main-doc-root 
(doc-flags d)))

+  (define (can-build*? docs) (can-build? only-dirs docs))
+  (define main-db (find-doc-db-path latex-dest #f main-doc-exists?))
+  (define user-db (find-doc-db-path latex-dest #t main-doc-exists?))
+  ;; Ensure that databases are created:
+  (define (touch-db db-file)
+    (doc-db-disconnect
+     (doc-db-file->connection db-file #t)))
+  (when (ormap can-build*? main-docs)
+    (touch-db main-db))
+  (when (ormap can-build*? user-docs)
+    (touch-db user-db))
    (when (and (or (not only-dirs) tidy?)
               (not avoid-main?)
               (not latex-dest))
@@ -256,7 +270,6 @@

-  (define (can-build*? docs) (can-build? only-dirs docs))
    (define auto-main? (and auto-start-doc?
                            (or (ormap can-build*? main-docs)
                                (and tidy? (not avoid-main?)))))
@@ -399,9 +412,6 @@
          (get-files! #f)
          (doc-db-clean-files user-db files))))

-  (define main-db (find-doc-db-path latex-dest #f main-doc-exists?))
-  (define user-db (find-doc-db-path latex-dest #t main-doc-exists?))
    (define (make-loop first? iter)
      (let ([infos (filter-not info-failed? infos)]
            [src->info (make-hash)]

Posted on the dev mailing list.