GNU bug report logs - #48111
tilde in Go package names (eg. sourcehut hosted packages)

Previous Next

Package: guix;

Reported by: raingloom <raingloom <at> riseup.net>

Date: Thu, 29 Apr 2021 23:21:01 UTC

Severity: normal

Done: Leo Prikler <leo.prikler <at> student.tugraz.at>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 48111 in the body.
You can then email your comments to 48111 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-guix <at> gnu.org:
bug#48111; Package guix. (Thu, 29 Apr 2021 23:21:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to raingloom <raingloom <at> riseup.net>:
New bug report received and forwarded. Copy sent to bug-guix <at> gnu.org. (Thu, 29 Apr 2021 23:21:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: raingloom <raingloom <at> riseup.net>
To: Guix Bugs <bug-guix <at> gnu.org>
Subject: tilde in Go package names (eg. sourcehut hosted packages)
Date: Thu, 29 Apr 2021 19:54:15 +0200
Trying to import kineto and getting this error when building it:

guix build: error: invalid character `~' in name
`go-git-sr-ht-~sircmpwn-kineto-0.0.0-20210225135222-edd4fe31f16f-checkout.drv'

I know the names are significant in go-build-system so I'm not sure how
to work around the issue without breaking anything.




Information forwarded to bug-guix <at> gnu.org:
bug#48111; Package guix. (Fri, 30 Apr 2021 09:55:02 GMT) Full text and rfc822 format available.

Message #8 received at 48111 <at> debbugs.gnu.org (full text, mbox):

From: Leo Prikler <leo.prikler <at> student.tugraz.at>
To: raingloom <raingloom <at> riseup.net>, 48111 <at> debbugs.gnu.org
Subject: Re: tilde in Go package names (eg. sourcehut hosted packages)
Date: Fri, 30 Apr 2021 11:53:40 +0200
Am Donnerstag, den 29.04.2021, 19:54 +0200 schrieb raingloom:
> Trying to import kineto and getting this error when building it:
> 
> guix build: error: invalid character `~' in name
> `go-git-sr-ht-~sircmpwn-kineto-0.0.0-20210225135222-edd4fe31f16f-
> checkout.drv'
> 
> I know the names are significant in go-build-system so I'm not sure
> how
> to work around the issue without breaking anything.
The way Go works, I would hazard a guess, that 
  module git.sr.ht/~sircmpwn/kineto
and 
  module git.sr.ht/sircmpwn/kineto
name two different modules.  However, as the latter can't exist since
sr.ht prefixes user names with ~, I think a name transformation, that
maps the former to the latter should be safe.  On the other hand, since
this just affects store file names, we might instead want to map "~" to
"-" in the general case of it appearing anywhere.  WDYT? 

Regards,
Leo





Information forwarded to bug-guix <at> gnu.org:
bug#48111; Package guix. (Mon, 03 May 2021 09:08:02 GMT) Full text and rfc822 format available.

Message #11 received at 48111 <at> debbugs.gnu.org (full text, mbox):

From: raingloom <raingloom <at> riseup.net>
To: Leo Prikler <leo.prikler <at> student.tugraz.at>
Cc: 48111 <at> debbugs.gnu.org
Subject: Re: tilde in Go package names (eg. sourcehut hosted packages)
Date: Mon, 3 May 2021 04:16:15 +0200
On Fri, 30 Apr 2021 11:53:40 +0200
Leo Prikler <leo.prikler <at> student.tugraz.at> wrote:

> Am Donnerstag, den 29.04.2021, 19:54 +0200 schrieb raingloom:
> > Trying to import kineto and getting this error when building it:
> > 
> > guix build: error: invalid character `~' in name
> > `go-git-sr-ht-~sircmpwn-kineto-0.0.0-20210225135222-edd4fe31f16f-
> > checkout.drv'
> > 
> > I know the names are significant in go-build-system so I'm not sure
> > how
> > to work around the issue without breaking anything.  
> The way Go works, I would hazard a guess, that 
>   module git.sr.ht/~sircmpwn/kineto
> and 
>   module git.sr.ht/sircmpwn/kineto
> name two different modules.  However, as the latter can't exist since
> sr.ht prefixes user names with ~, I think a name transformation, that
> maps the former to the latter should be safe.  On the other hand,
> since this just affects store file names, we might instead want to
> map "~" to "-" in the general case of it appearing anywhere.  WDYT? 
> 
> Regards,
> Leo
> 

It turns out that it's okay to change the names, only the input alist
keys are significant. So it was relatively quick to fix this by hand.
Not sure how the importer should handle it. I've been meaning to look
at importers for a while, because I wanna tackle either a Chicken or an
Akku importer, so, I'll try something Eventually (TM), but can't
promise a deadline.




Information forwarded to bug-guix <at> gnu.org:
bug#48111; Package guix. (Sun, 04 Jul 2021 22:52:01 GMT) Full text and rfc822 format available.

Message #14 received at 48111 <at> debbugs.gnu.org (full text, mbox):

From: Sarah Morgensen <iskarian <at> mgsn.dev>
To: Leo Prikler <leo.prikler <at> student.tugraz.at>
Cc: 48111 <at> debbugs.gnu.org, raingloom <raingloom <at> riseup.net>
Subject: Re: bug#48111: tilde in Go package names (eg. sourcehut hosted
 packages)
Date: Sun, 04 Jul 2021 15:51:07 -0700
[Message part 1 (text/plain, inline)]
Hello,

Leo Prikler <leo.prikler <at> student.tugraz.at> writes:

> Am Donnerstag, den 29.04.2021, 19:54 +0200 schrieb raingloom:
>> Trying to import kineto and getting this error when building it:
>> 
>> guix build: error: invalid character `~' in name
>> `go-git-sr-ht-~sircmpwn-kineto-0.0.0-20210225135222-edd4fe31f16f-
>> checkout.drv'
>> 
>> I know the names are significant in go-build-system so I'm not sure
>> how
>> to work around the issue without breaking anything.

As far as I can tell, the go-build-system doesn't care about the actual
package names, just #:import-path and #:unpack-path. The names should
only be significant to the go importer insofar as
go-module->guix-package-name does not generate collisions.

> The way Go works, I would hazard a guess, that 
>   module git.sr.ht/~sircmpwn/kineto
> and 
>   module git.sr.ht/sircmpwn/kineto
> name two different modules.  However, as the latter can't exist since
> sr.ht prefixes user names with ~, I think a name transformation, that
> maps the former to the latter should be safe.  On the other hand, since
> this just affects store file names, we might instead want to map "~" to
> "-" in the general case of it appearing anywhere.  WDYT?

It might be slightly uglier, but I think it's better to keep a
consistent policy of "replace any invalid characters with a hyphen", as
it is less likely to generate collisions and it provides a hint to the
reader that there *is* a character there.

I have attached a patch to do so below, verified that a recursive import
of the package mentioned above builds without modification (well, I had
to update a dependency...) and verified that there are not currently any
go packages using a tilde in their name with:

$ egrep -r '"go-[^"]*~[^"]*"' gnu/packages

[0001-import-go-Replace-tildes-with-hyphens-in-package-nam.patch (text/x-patch, inline)]
From 2c942a06cf94acdca07f2a59736c89521953af0f Mon Sep 17 00:00:00 2001
Message-Id: <2c942a06cf94acdca07f2a59736c89521953af0f.1625436903.git.iskarian <at> mgsn.dev>
From: Sarah Morgensen <iskarian <at> mgsn.dev>
Date: Sun, 4 Jul 2021 15:00:15 -0700
Subject: [PATCH] import: go: Replace tildes with hyphens in package names.

Fixes <https://issues.guix.gnu.org/48111>.

* guix/import/go.scm (go-module->guix-package-name): Replace tildes with
hyphens.
---
 guix/import/go.scm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/guix/import/go.scm b/guix/import/go.scm
index 5e23d6a2b3..d8f838f635 100644
--- a/guix/import/go.scm
+++ b/guix/import/go.scm
@@ -430,9 +430,9 @@ hence the need to derive this information."
 (define* (go-module->guix-package-name module-path #:optional version)
   "Converts a module's path to the canonical Guix format for Go packages.
 Optionally include a VERSION string to append to the name."
-  ;; Map dot, slash and underscore characters to hyphens.
+  ;; Map dot, slash, underscore and tilde characters to hyphens.
   (let ((module-path* (string-map (lambda (c)
-                                    (if (member c '(#\. #\/ #\_))
+                                    (if (member c '(#\. #\/ #\_ #\~))
                                         #\-
                                         c))
                                   module-path)))

base-commit: 9e63bafafbe7a7c2d9804fae62302ac8a7e90090
-- 
2.31.1

[Message part 3 (text/plain, inline)]
--
Sarah

Reply sent to Leo Prikler <leo.prikler <at> student.tugraz.at>:
You have taken responsibility. (Mon, 05 Jul 2021 07:58:02 GMT) Full text and rfc822 format available.

Notification sent to raingloom <raingloom <at> riseup.net>:
bug acknowledged by developer. (Mon, 05 Jul 2021 07:58:02 GMT) Full text and rfc822 format available.

Message #19 received at 48111-done <at> debbugs.gnu.org (full text, mbox):

From: Leo Prikler <leo.prikler <at> student.tugraz.at>
To: Sarah Morgensen <iskarian <at> mgsn.dev>
Cc: 48111-done <at> debbugs.gnu.org, raingloom <raingloom <at> riseup.net>
Subject: Re: bug#48111: tilde in Go package names (eg. sourcehut hosted
 packages)
Date: Mon, 05 Jul 2021 09:57:14 +0200
Hello,

Am Sonntag, den 04.07.2021, 15:51 -0700 schrieb Sarah Morgensen:
> It might be slightly uglier, but I think it's better to keep a
> consistent policy of "replace any invalid characters with a hyphen",
> as it is less likely to generate collisions and it provides a hint to
> the reader that there *is* a character there.
Fair enough, that's a reasonable take.

> I have attached a patch to do so below, verified that a recursive
> import of the package mentioned above builds without modification
> (well, I had to update a dependency...) and verified that there are
> not currently any go packages using a tilde in their name with:
> 
> $ egrep -r '"go-[^"]*~[^"]*"' gnu/packages
I couldn't verify this as the importer delivered 410s, but the patch
LGTM, so I pushed it.

Thanks,
Leo





bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 02 Aug 2021 11:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 265 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.