From edbe07cd67d6050d94fe8ac1af15ab15e857b61d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Thu, 20 Jul 2017 15:23:13 +0200 Subject: [PATCH] guix package: Trim trailing slashes from the profile name. Fixes . Reported by Ricardo Wurmus . * guix/scripts/package.scm (canonicalize-profile): Trim trailing slashes from PROFILE. --- guix/scripts/package.scm | 16 ++++++++++------ 1 file 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 - (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