GNU bug report logs - #35603
Go build system mishandles repetitive import paths (was [PATCH] build: go-build-system: Ensure uniform unpacking directory.)

Previous Next

Package: guix;

Reported by: Leo Famulari <leo <at> famulari.name>

Date: Mon, 6 May 2019 15:44:02 UTC

Severity: normal

Tags: patch

Done: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>

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 35603 in the body.
You can then email your comments to 35603 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#35603; Package guix. (Mon, 06 May 2019 15:44:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Leo Famulari <leo <at> famulari.name>:
New bug report received and forwarded. Copy sent to bug-guix <at> gnu.org. (Mon, 06 May 2019 15:44:02 GMT) Full text and rfc822 format available.

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

From: Leo Famulari <leo <at> famulari.name>
To: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
Cc: bug-guix <at> gnu.org
Subject: Go build system mishandles repetitive import paths (was [PATCH]
 build: go-build-system: Ensure uniform unpacking directory.)
Date: Mon, 6 May 2019 11:42:49 -0400
[Message part 1 (text/plain, inline)]
On Sun, Apr 14, 2019 at 12:03:05AM -0400, Maxim Cournoyer wrote:
> From 1f7535fbe28f7ac96e824b792e9f1a140b8c54cd Mon Sep 17 00:00:00 2001
> From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
> Date: Fri, 5 Apr 2019 00:00:08 -0400
> Subject: [PATCH 3/3] build: go-build-system: Ensure uniform unpacking
>  directory.
> 
> Depending on whether the source is a directory or an archive, we strip the
> source directory or preserve it, respectively.  This change makes it so that
> whether the type of the source, it is unpacked at the expected location given
> by the IMPORT-PATH of the Go build system.
> 
> * guix/build/go-build-system.scm: Add the (ice-9 ftw) module.
> (unpack): Add inner procedure to maybe strip the top level directory of an
> archive, document it and use it.

This commit (or patch series) broke the build of Syncthing and maybe
others.

It seems like the the new unpacking code is stripping duplicate
directory names?

It fails like this:

------
starting phase `increase-test-timeout'
Backtrace:
           6 (primitive-load "/gnu/store/yfvy06fscz726da5wjvh9jxjsah…")
In ice-9/eval.scm:
   191:35  5 (_ _)
In srfi/srfi-1.scm:
   863:16  4 (every1 #<procedure 870540 at /gnu/store/zmc0hcmdfg5n4…> …)
In /gnu/store/zmc0hcmdfg5n4kl32vcla4cg9c9bspfg-module-import/guix/build/gnu-build-system.scm:
   799:28  3 (_ _)
In ice-9/eval.scm:
    619:8  2 (_ #(#(#<directory (guile-user) 5ce140>) (#:inputs # …)))
In /gnu/store/zmc0hcmdfg5n4kl32vcla4cg9c9bspfg-module-import/guix/build/utils.scm:
   635:19  1 (with-atomic-file-replacement "src/github.com/syncthin…" …)
In unknown file:
           0 (mkstemp! "src/github.com/syncthing/syncthing/build.go…" …)

ERROR: In procedure mkstemp!:
In procedure mkstemp!: No such file or directory
------

And indeed, if you keep the failed build directory, you will see that
the path 'src/github.com/syncthing/syncthing' does not exist, even
though this corresponds to the Go import path specified in the package
definition.

Instead it is like src/github.com/syncthing' which is incorrect.
[signature.asc (application/pgp-signature, inline)]

Information forwarded to bug-guix <at> gnu.org:
bug#35603; Package guix. (Mon, 06 May 2019 15:57:01 GMT) Full text and rfc822 format available.

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

From: Leo Famulari <leo <at> famulari.name>
To: 35603 <at> debbugs.gnu.org
Subject: Re: Go build system mishandles repetitive import paths
Date: Mon, 6 May 2019 11:56:17 -0400
[Message part 1 (text/plain, inline)]
Looks like it affects packages that use tarballs (instead of Git
checkouts) and have a repetitive element in the import path. For
example, 'github.com/restic/restic' is also broken.
[signature.asc (application/pgp-signature, inline)]

Reply sent to Maxim Cournoyer <maxim.cournoyer <at> gmail.com>:
You have taken responsibility. (Tue, 07 May 2019 01:11:02 GMT) Full text and rfc822 format available.

Notification sent to Leo Famulari <leo <at> famulari.name>:
bug acknowledged by developer. (Tue, 07 May 2019 01:11:02 GMT) Full text and rfc822 format available.

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

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: Leo Famulari <leo <at> famulari.name>
Cc: 35603-done <at> debbugs.gnu.org
Subject: Re: Go build system mishandles repetitive import paths (was [PATCH]
 build: go-build-system: Ensure uniform unpacking directory.)
Date: Mon, 06 May 2019 21:10:21 -0400
Hello Leo,

Leo Famulari <leo <at> famulari.name> writes:

> On Sun, Apr 14, 2019 at 12:03:05AM -0400, Maxim Cournoyer wrote:
>> From 1f7535fbe28f7ac96e824b792e9f1a140b8c54cd Mon Sep 17 00:00:00 2001
>> From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
>> Date: Fri, 5 Apr 2019 00:00:08 -0400
>> Subject: [PATCH 3/3] build: go-build-system: Ensure uniform unpacking
>>  directory.
>>
>> Depending on whether the source is a directory or an archive, we strip the
>> source directory or preserve it, respectively.  This change makes it so that
>> whether the type of the source, it is unpacked at the expected location given
>> by the IMPORT-PATH of the Go build system.
>>
>> * guix/build/go-build-system.scm: Add the (ice-9 ftw) module.
>> (unpack): Add inner procedure to maybe strip the top level directory of an
>> archive, document it and use it.
>
> This commit (or patch series) broke the build of Syncthing and maybe
> others.

Thanks for the heads-up!

> It seems like the the new unpacking code is stripping duplicate
> directory names?
>

It does as documented in the docstring of the unpack phase:

   If the SOURCE archive has a single top level directory,
   it is stripped so that the sources appear directly under UNPACK-PATH.

This behavior was made possible with commit
f42e4ebb56fe4f16991ca6c6e060c8f3535865cb, that made it so that:

    [...] whether the type of the source, it is unpacked at the expected
    location given by the IMPORT-PATH of the Go build system.

> It fails like this:
>
> ------
> starting phase `increase-test-timeout'
> Backtrace:
>            6 (primitive-load "/gnu/store/yfvy06fscz726da5wjvh9jxjsah…")
> In ice-9/eval.scm:
>    191:35  5 (_ _)
> In srfi/srfi-1.scm:
>    863:16  4 (every1 #<procedure 870540 at /gnu/store/zmc0hcmdfg5n4…> …)
> In /gnu/store/zmc0hcmdfg5n4kl32vcla4cg9c9bspfg-module-import/guix/build/gnu-build-system.scm:
>    799:28  3 (_ _)
> In ice-9/eval.scm:
>     619:8  2 (_ #(#(#<directory (guile-user) 5ce140>) (#:inputs # …)))
> In /gnu/store/zmc0hcmdfg5n4kl32vcla4cg9c9bspfg-module-import/guix/build/utils.scm:
>    635:19  1 (with-atomic-file-replacement "src/github.com/syncthin…" …)
> In unknown file:
>            0 (mkstemp! "src/github.com/syncthing/syncthing/build.go…" …)
>
> ERROR: In procedure mkstemp!:
> In procedure mkstemp!: No such file or directory
> ------
>
> And indeed, if you keep the failed build directory, you will see that
> the path 'src/github.com/syncthing/syncthing' does not exist, even
> though this corresponds to the Go import path specified in the package
> definition.
>
> Instead it is like src/github.com/syncthing' which is incorrect.

The fix was to drop the "unpack-pack" argument of the go-build-system for
syncthing, which means we want the sources unpacked at the location
specified by the "import-path".

Done with commit d879fd80c74371120a2cfa30e18a2e28dc02d31d; closing.

Thank you!

Maxim




Information forwarded to bug-guix <at> gnu.org:
bug#35603; Package guix. (Tue, 07 May 2019 02:43:02 GMT) Full text and rfc822 format available.

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

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: Leo Famulari <leo <at> famulari.name>
Cc: 35603 <at> debbugs.gnu.org
Subject: Re: bug#35603: Go build system mishandles repetitive import paths
Date: Mon, 06 May 2019 22:42:49 -0400
Hello again,

Leo Famulari <leo <at> famulari.name> writes:

> Looks like it affects packages that use tarballs (instead of Git
> checkouts) and have a repetitive element in the import path. For
> example, 'github.com/restic/restic' is also broken.

I've fixed restic with commit fb09818277; sorry!

Maxim




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 04 Jun 2019 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 300 days ago.

Previous Next


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