From unknown Thu Sep 11 09:18:22 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#50289 <50289@debbugs.gnu.org> To: bug#50289 <50289@debbugs.gnu.org> Subject: Status: [PATCH] import: go: Fix import when import path redirects. Reply-To: bug#50289 <50289@debbugs.gnu.org> Date: Thu, 11 Sep 2025 16:18:22 +0000 retitle 50289 [PATCH] import: go: Fix import when import path redirects. reassign 50289 guix-patches submitter 50289 Sarah Morgensen severity 50289 normal tag 50289 patch thanks From debbugs-submit-bounces@debbugs.gnu.org Mon Aug 30 22:05:41 2021 Received: (at submit) by debbugs.gnu.org; 31 Aug 2021 02:05:41 +0000 Received: from localhost ([127.0.0.1]:60710 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mKt9h-00039w-Hn for submit@debbugs.gnu.org; Mon, 30 Aug 2021 22:05:41 -0400 Received: from lists.gnu.org ([209.51.188.17]:57434) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mKt9c-00039l-CA for submit@debbugs.gnu.org; Mon, 30 Aug 2021 22:05:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41274) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mKt9Y-0008CF-Ut for guix-patches@gnu.org; Mon, 30 Aug 2021 22:05:36 -0400 Received: from out2.migadu.com ([2001:41d0:2:aacc::]:37571) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mKt9V-0002LJ-2e for guix-patches@gnu.org; Mon, 30 Aug 2021 22:05:32 -0400 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mgsn.dev; s=key1; t=1630375522; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=kQE/QMOilsNZXvQzOCE7aHE6RQoYdUpKJ+BrVIQaV5Y=; b=Iqs1blDc2j3VSl+X9NU8cr6Hks+GRENKFjsqq9gcfHmKAxVJCfFvmXC2D6lv1ENAjZWLEi C/07WqtBJ1UuZW6yKUaxejtMTp+r2H5gffy4BQ/wAkfFrWMjUD9n5OzsUqYxeUp3vDQ1b1 VPJHqpfHrPOv/2bnPCEsaDZ2uaudKI0= From: Sarah Morgensen To: guix-patches@gnu.org Subject: [PATCH] import: go: Fix import when import path redirects. Date: Mon, 30 Aug 2021 19:05:19 -0700 Message-Id: MIME-Version: 1.0 X-Debbugs-CC: Attila Lendvai Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: iskarian@mgsn.dev Received-SPF: pass client-ip=2001:41d0:2:aacc::; envelope-from=iskarian@mgsn.dev; helo=out2.migadu.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.4 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.4 (--) * guix/import/go.scm (fetch-module-meta-data): If no meta entries have a matching import prefix, return the first entry instead of #f. --- X-Debbugs-CC: Attila Lendvai Hello Guix, As reported by Attila on IRC, the Go importer currently chokes when the import path URL redirects, for example with "github.com/prometheus/tsdb". This is due to my modification to 'fetch-module-meta-data' to handle multiple package's meta tags on one page [0]. It selects the meta based on whether its import prefix matches the URL we requested. This breaks when the URL redirects but the import path is not changed (I did not realize that this was valid... go figure). This patch fixes that by falling back to the first meta if none match. [0] https://issues.guix.gnu.org/49591 -- Sarah guix/import/go.scm | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/guix/import/go.scm b/guix/import/go.scm index 617a0d0e23..57a135b9a9 100644 --- a/guix/import/go.scm +++ b/guix/import/go.scm @@ -483,9 +483,12 @@ (define (fetch-module-meta-data module-path) (match (select (html->sxml meta-data #:strict? #t)) (() #f) ;nothing selected ((('content content-text) ..1) - (find (lambda (meta) - (string-prefix? (module-meta-import-prefix meta) module-path)) - (map go-import->module-meta content-text)))))) + (or + (find (lambda (meta) + (string-prefix? (module-meta-import-prefix meta) module-path)) + (map go-import->module-meta content-text)) + ;; Fallback to the first meta if no import prefixes match. + (go-import->module-meta (first content-text))))))) (define (module-meta-data-repo-url meta-data goproxy) "Return the URL where the fetcher which will be used can download the base-commit: 994d8ce394e88b55985241b7b14f6a8459bcf9e8 -- 2.31.1 From debbugs-submit-bounces@debbugs.gnu.org Tue Sep 07 09:55:31 2021 Received: (at 50289-done) by debbugs.gnu.org; 7 Sep 2021 13:55:31 +0000 Received: from localhost ([127.0.0.1]:56144 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mNbZT-00046a-3Z for submit@debbugs.gnu.org; Tue, 07 Sep 2021 09:55:31 -0400 Received: from eggs.gnu.org ([209.51.188.92]:36290) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mNbZL-00042p-SS for 50289-done@debbugs.gnu.org; Tue, 07 Sep 2021 09:55:29 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:49980) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mNbZG-0002vc-8E; Tue, 07 Sep 2021 09:55:18 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=35362 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mNbZF-0006nN-VN; Tue, 07 Sep 2021 09:55:18 -0400 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Sarah Morgensen Subject: Re: bug#50289: [PATCH] import: go: Fix import when import path redirects. References: Date: Tue, 07 Sep 2021 15:55:16 +0200 In-Reply-To: (Sarah Morgensen's message of "Mon, 30 Aug 2021 19:05:19 -0700") Message-ID: <87zgso4hiz.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 50289-done Cc: Attila Lendvai , 50289-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Hi, Sarah Morgensen skribis: > * guix/import/go.scm (fetch-module-meta-data): If no meta entries > have a matching import prefix, return the first entry instead of #f. > --- > X-Debbugs-CC: Attila Lendvai > > Hello Guix, > > As reported by Attila on IRC, the Go importer currently chokes when the > import path URL redirects, for example with "github.com/prometheus/tsdb". > > This is due to my modification to 'fetch-module-meta-data' to handle mult= iple > package's meta tags on one page [0]. It selects the meta based on whethe= r its > import prefix matches the URL we requested. This breaks when the URL > redirects but the import path is not changed (I did not realize that this > was valid... go figure). This patch fixes that by falling back to the fi= rst > meta if none match. > > [0] https://issues.guix.gnu.org/49591 Applied, thank you! Ludo=E2=80=99. From unknown Thu Sep 11 09:18:22 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Wed, 06 Oct 2021 11:24:13 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator