mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-12-24 05:18:07 -05:00
list-runtime-root: Fix off-by-one in 'strip-drop' call.
Fixes <https://bugs.gnu.org/29862>. Reported by Danny Milosavljevic <dannym@scratchpost.org>. * nix/scripts/list-runtime-roots.in (canonicalize-store-item): Define 'store' with a trailing "/". Have the 'string-prefix?' call match the 'string-drop' call.
This commit is contained in:
parent
1c27f72fc2
commit
091191c3dc
1 changed files with 4 additions and 3 deletions
|
@ -130,12 +130,13 @@ or the empty list."
|
|||
(< (string->number a) (string->number b))))))
|
||||
|
||||
(define canonicalize-store-item
|
||||
(let ((prefix (+ 1 (string-length %store-directory))))
|
||||
(let* ((store (string-append %store-directory "/"))
|
||||
(prefix (string-length store)))
|
||||
(lambda (file)
|
||||
"Return #f if FILE is not a store item; otherwise, return the store file
|
||||
name without any sub-directory components."
|
||||
(and (string-prefix? %store-directory file)
|
||||
(string-append %store-directory "/"
|
||||
(and (string-prefix? store file)
|
||||
(string-append store
|
||||
(let ((base (string-drop file prefix)))
|
||||
(match (string-index base #\/)
|
||||
(#f base)
|
||||
|
|
Loading…
Reference in a new issue