unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: zimoun <zimon.toutoune@gmail.com>
To: Hartmut Goebel <h.goebel@crazy-compilers.com>
Cc: 37523@debbugs.gnu.org
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	[thread overview]
Message-ID: <86lfdr9t67.fsf@gmail.com> (raw)
In-Reply-To: <80714a9a-b70d-8810-0f1b-606b8a6b8743@crazy-compilers.com> (Hartmut Goebel's message of "Thu, 26 Sep 2019 18:01:40 +0200")

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





  reply	other threads:[~2020-12-21 13:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-26 16:01 bug#37523: Print hint if build fails due to invalid character in package source base name Hartmut Goebel
2020-12-21 13:37 ` zimoun [this message]
2020-12-21 14:16   ` Hartmut Goebel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86lfdr9t67.fsf@gmail.com \
    --to=zimon.toutoune@gmail.com \
    --cc=37523@debbugs.gnu.org \
    --cc=h.goebel@crazy-compilers.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).