summaryrefslogtreecommitdiff
path: root/guix/scripts/package.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2017-07-20 15:23:13 +0200
committerLudovic Courtès <ludo@gnu.org>2017-07-20 15:29:15 +0200
commitedbe07cd67d6050d94fe8ac1af15ab15e857b61d (patch)
treee18d1c7c78c690740446805d93f9ff38afb7d013 /guix/scripts/package.scm
parent457103b90bba42d4eaf508031044548c3ba95723 (diff)
downloadgnu-guix-edbe07cd67d6050d94fe8ac1af15ab15e857b61d.tar
gnu-guix-edbe07cd67d6050d94fe8ac1af15ab15e857b61d.tar.gz
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.
Diffstat (limited to 'guix/scripts/package.scm')
-rw-r--r--guix/scripts/package.scm16
1 files changed, 10 insertions, 6 deletions
diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm
index 58da3113a0..96ee5c00ed 100644
--- a/guix/scripts/package.scm
+++ b/guix/scripts/package.scm
@@ -84,12 +84,16 @@
"If PROFILE is %USER-PROFILE-DIRECTORY, return %CURRENT-PROFILE. Otherwise
return PROFILE unchanged. The goal is to treat '-p ~/.guix-profile' as if
'-p' was omitted." ; see <http://bugs.gnu.org/17939>
- (if (and %user-profile-directory
- (string=? (canonicalize-path (dirname profile))
- (dirname %user-profile-directory))
- (string=? (basename profile) (basename %user-profile-directory)))
- %current-profile
- profile))
+
+ ;; Trim trailing slashes so that the basename comparison below works as
+ ;; intended.
+ (let ((profile (string-trim-right profile #\/)))
+ (if (and %user-profile-directory
+ (string=? (canonicalize-path (dirname profile))
+ (dirname %user-profile-directory))
+ (string=? (basename profile) (basename %user-profile-directory)))
+ %current-profile
+ profile)))
(define (user-friendly-profile profile)
"Return either ~/.guix-profile if that's what PROFILE refers to, directly or