Subject: bug#73438: closed (Re: [bug#73438] [PATCH] Better error message in checkStoreName)

From: [email-masked] (GNU bug Tracking System)
Date: Sun, 17 Nov 2024 21:46:02 +0000

Your bug report

#73438: [PATCH] Better error message in checkStoreName

which was filed against the guix-patches package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
73438: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=73438
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: [bug#73438] [PATCH] Better error message in checkStoreName
From: Ludovic Courtès <[email-masked]>
To: Brennan Vincent <[email-masked]>
Cc: [email-masked]
Date: Sun, 17 Nov 2024 22:42:58 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

Brennan Vincent <[email-masked]> skribis:

> When trying to pass a local-file beginning with a dot to something like
> home-files-service-type, one gets an error message like:
>
> guix home: error: invalid name: `.vimrc'
>
> which does not explain what went wrong. This update should make it more clear.
>
> Change-Id: I045a663bc6cd9844677c65b38a31d3941cf212b5

I tweaked the commit log to match our conventions and applied it,
thanks!

Ludo’.

Subject: [PATCH] Better error message in checkStoreName
From: Brennan Vincent <[email-masked]>
To: [email-masked]
Date: Mon, 23 Sep 2024 07:21:07 -0400
List-Id: <debbugs-submit.debbugs.gnu.org>

When trying to pass a local-file beginning with a dot to something like
home-files-service-type, one gets an error message like:

guix home: error: invalid name: `.vimrc'

which does not explain what went wrong. This update should make it more clear.

Change-Id: I045a663bc6cd9844677c65b38a31d3941cf212b5
---
 nix/libstore/store-api.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/nix/libstore/store-api.cc b/nix/libstore/store-api.cc
index 781fb9e693..38a1403a71 100644
--- a/nix/libstore/store-api.cc
+++ b/nix/libstore/store-api.cc
@@ -61,7 +61,7 @@ void checkStoreName(const string & name)
     /* Disallow names starting with a dot for possible security
        reasons (e.g., "." and ".."). */
     if (string(name, 0, 1) == ".")
-        throw Error(format("invalid name: `%1%'") % name);
+        throw Error(format("invalid name: `%1%' (can't begin with dot)") % name);
     foreach (string::const_iterator, i, name)
         if (!((*i >= 'A' && *i <= 'Z') ||
               (*i >= 'a' && *i <= 'z') ||

base-commit: 6ea75bb9bcc52521f0bb3f121799745fdc17f1c9
-- 
2.46.0