store: 'references/substitutes' correctly handles the order of substitutes.
Before that, 'references/substitutes' would assume that 'substitutable-path-info' would return things in the same order as its arguments, which is not the case. Thus, it would sometimes provide incorrect reference information, occasionally leading to infinite loop (because dependency information would denote cycles.) Fixes <http://bugs.gnu.org/22914>. Reported by Eric Bavier <ericbavier@openmailbox.org>. * guix/store.scm (references/substitutes): Make ITEMS the first argument of the loop; match on it. Use 'any' to find a matching substitute. (substitutable-path-info): Clarify docstring about ordering.
This commit is contained in:
parent
451b5c5dc6
commit
dd78e90a4d
@ -752,18 +752,24 @@ the list of references")
|
|||||||
(status 1)))))
|
(status 1)))))
|
||||||
|
|
||||||
;; Intersperse SUBSTS and LOCAL-REFS.
|
;; Intersperse SUBSTS and LOCAL-REFS.
|
||||||
(let loop ((local-refs local-refs)
|
(let loop ((items items)
|
||||||
(remote-refs (map substitutable-references substs))
|
(local-refs local-refs)
|
||||||
(result '()))
|
(result '()))
|
||||||
(match local-refs
|
(match items
|
||||||
(()
|
(()
|
||||||
(reverse result))
|
(reverse result))
|
||||||
((#f tail ...)
|
((item items ...)
|
||||||
(match remote-refs
|
(match local-refs
|
||||||
((remote rest ...)
|
((#f tail ...)
|
||||||
(loop tail rest (cons remote result)))))
|
(loop items tail
|
||||||
((head tail ...)
|
(cons (any (lambda (subst)
|
||||||
(loop tail remote-refs (cons head result)))))))
|
(and (string=? (substitutable-path subst) item)
|
||||||
|
(substitutable-references subst)))
|
||||||
|
substs)
|
||||||
|
result)))
|
||||||
|
((head tail ...)
|
||||||
|
(loop items tail
|
||||||
|
(cons head result)))))))))
|
||||||
|
|
||||||
(define* (fold-path store proc seed path
|
(define* (fold-path store proc seed path
|
||||||
#:optional (relatives (cut references store <>)))
|
#:optional (relatives (cut references store <>)))
|
||||||
@ -852,7 +858,9 @@ topological order."
|
|||||||
(operation (query-substitutable-path-infos (store-path-list paths))
|
(operation (query-substitutable-path-infos (store-path-list paths))
|
||||||
"Return information about the subset of PATHS that is
|
"Return information about the subset of PATHS that is
|
||||||
substitutable. For each substitutable path, a `substitutable?' object is
|
substitutable. For each substitutable path, a `substitutable?' object is
|
||||||
returned."
|
returned; thus, the resulting list can be shorter than PATHS. Furthermore,
|
||||||
|
that there is no guarantee that the order of the resulting list matches the
|
||||||
|
order of PATHS."
|
||||||
substitutable-path-list))
|
substitutable-path-list))
|
||||||
|
|
||||||
(define-operation (optimize-store)
|
(define-operation (optimize-store)
|
||||||
|
Loading…
Reference in New Issue
Block a user