[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#37523: Print hint if build fails due to invalid character in package
From: |
zimoun |
Subject: |
bug#37523: Print hint if build fails due to invalid character in package source base name |
Date: |
Mon, 21 Dec 2020 14:37:20 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) |
Hi,
On Thu, 26 Sep 2019 at 18:01, Hartmut Goebel <h.goebel@crazy-compilers.com>
wrote:
> guix shall print a hint if building fails due to the package source base
> name containing a character invalid in a store filename (e.g. "@" or "%").
>
> Currently, when building such a package, one gets an error message like:
>
> guix build: error: invalid character `@' in name
> `kde-l10n-ca@valencia-14.11.80.tar.xz.drv'
>
>
> guix build should catch this error and print a hint like:
>
> You may add a ‘file-name’ field to the package source to work around
> this.
>
>
> Ludovic Courtès wrote on Sun Sep 08 22:07:10+0200 2019
>
>> Unfortunately it cannot really be caught. I mean, you could catch
>> ‘&store-protocol-error’ error conditions, but then the error message is
>> just a string, there’s no error code you can compare against.
If I read correctly, the error is raised by nix/libstore/store-api.cc:
--8<---------------cut here---------------start------------->8---
void checkStoreName(const string & name)
{
string validChars = "+-._?=";
/* 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);
foreach (string::const_iterator, i, name)
if (!((*i >= 'A' && *i <= 'Z') ||
(*i >= 'a' && *i <= 'z') ||
(*i >= '0' && *i <= '9') ||
validChars.find(*i) != string::npos))
{
throw Error(format("invalid character `%1%' in name `%2%'")
% *i % name);
}
}
--8<---------------cut here---------------end--------------->8---
Therefore, I am missing if this message “invalid character” should be
improved or if the check of the name should be done before on the Scheme
side. Well, I am missing what could be the path to improve the
situation, if it needs.
All the best,
simon
- bug#37523: Print hint if build fails due to invalid character in package source base name,
zimoun <=