guix package: Trim trailing slashes from the profile name.
Fixes <https://bugs.gnu.org/25762>. Reported by Ricardo Wurmus <rekado@elephly.net>. * guix/scripts/package.scm (canonicalize-profile): Trim trailing slashes from PROFILE.
This commit is contained in:
parent
457103b90b
commit
edbe07cd67
@ -84,12 +84,16 @@
|
|||||||
"If PROFILE is %USER-PROFILE-DIRECTORY, return %CURRENT-PROFILE. Otherwise
|
"If PROFILE is %USER-PROFILE-DIRECTORY, return %CURRENT-PROFILE. Otherwise
|
||||||
return PROFILE unchanged. The goal is to treat '-p ~/.guix-profile' as if
|
return PROFILE unchanged. The goal is to treat '-p ~/.guix-profile' as if
|
||||||
'-p' was omitted." ; see <http://bugs.gnu.org/17939>
|
'-p' was omitted." ; see <http://bugs.gnu.org/17939>
|
||||||
(if (and %user-profile-directory
|
|
||||||
(string=? (canonicalize-path (dirname profile))
|
;; Trim trailing slashes so that the basename comparison below works as
|
||||||
(dirname %user-profile-directory))
|
;; intended.
|
||||||
(string=? (basename profile) (basename %user-profile-directory)))
|
(let ((profile (string-trim-right profile #\/)))
|
||||||
%current-profile
|
(if (and %user-profile-directory
|
||||||
profile))
|
(string=? (canonicalize-path (dirname profile))
|
||||||
|
(dirname %user-profile-directory))
|
||||||
|
(string=? (basename profile) (basename %user-profile-directory)))
|
||||||
|
%current-profile
|
||||||
|
profile)))
|
||||||
|
|
||||||
(define (user-friendly-profile profile)
|
(define (user-friendly-profile profile)
|
||||||
"Return either ~/.guix-profile if that's what PROFILE refers to, directly or
|
"Return either ~/.guix-profile if that's what PROFILE refers to, directly or
|
||||||
|
Loading…
Reference in New Issue
Block a user