From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id OJxcH5COLWFSZQEAgWs5BA (envelope-from ) for ; Tue, 31 Aug 2021 04:06:08 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id gDwFG5COLWHSCAAAB5/wlQ (envelope-from ) for ; Tue, 31 Aug 2021 02:06:08 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id D8BD18A21 for ; Tue, 31 Aug 2021 04:06:07 +0200 (CEST) Received: from localhost ([::1]:54054 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mKtA6-0008KD-Od for larch@yhetil.org; Mon, 30 Aug 2021 22:06:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41354) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mKtA2-0008JN-IJ for guix-patches@gnu.org; Mon, 30 Aug 2021 22:06:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:49170) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mKtA2-0002k1-8W for guix-patches@gnu.org; Mon, 30 Aug 2021 22:06:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mKtA1-0003Ay-PV; Mon, 30 Aug 2021 22:06:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#50289] [PATCH] import: go: Fix import when import path redirects. Resent-From: Sarah Morgensen Original-Sender: "Debbugs-submit" Resent-CC: attila@lendvai.name, guix-patches@gnu.org Resent-Date: Tue, 31 Aug 2021 02:06:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 50289 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 50289@debbugs.gnu.org Cc: Attila Lendvai X-Debbugs-Original-To: guix-patches@gnu.org X-Debbugs-Original-Xcc: Attila Lendvai Received: via spool by submit@debbugs.gnu.org id=B.163037554112152 (code B ref -1); Tue, 31 Aug 2021 02:06:01 +0000 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 Date: Mon, 30 Aug 2021 19:05:19 -0700 Message-Id: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1630375568; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=kQE/QMOilsNZXvQzOCE7aHE6RQoYdUpKJ+BrVIQaV5Y=; b=NxyhC/6OTBLM9bsSKikglmC2STx4ioXZdQHiWBQS+UA5iQ+Bx7YcX8L6SCSepL2+K+s1TH AX4om6aaA5kIgWz5jp26I5wQ3zEUwsoogHwM0MxKgCSY63sLzyhDBri0wigLufYuvDu6hm UkxRB5+ErQ++PbIO2AYDeVa0tmYa5CyPjtVRflCbRG1QUHWiTEu6VsaLH01IS3a5Ovz6iN tqhIORCiIqP09QrpCIy8dijYLpYpgNFOPfn2QUUvQqtnoa2B7vT56E9xwCSk19S/WVW9fS 9hq1OdB3BBEf8wc8qRDlGJ2vQ1OBScqY6VTvMGkjYBnQ1Q6KqMXpaE/wwFoOEA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1630375568; a=rsa-sha256; cv=none; b=a+PlUOOQSwVCtYjKY11A2GZfpu5o3+8nTzgtjXt+ZlN7scM0Q1swtOrqbFYk5rUM4WyQIQ RLHm/y2DBLwzIDBN6vwueiR4HHoWvUSlvgaSZiEPzUHZmNHitvnSuJmDCaichEjnHAaYg5 pIzOpNCScZJ2apu6QndD42JRc1uxB3ZQg/NSUze3aqe2ZSXVGdVhL2gOE19SO56ZsVmB4u iaLD41oNt1cQMPNgtcUDU1bObof+20QoV3CJq9D2akDAjXofCopOl/h1uHvNhjmbyStQ2q HP0c+79tmLjXzXzl11lLY84vvQl1jAs0raOI6eOP3a/vlZW1lymAH2rhAUCWJw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=mgsn.dev header.s=key1 header.b=Iqs1blDc; dmarc=fail reason="SPF not aligned (relaxed)" header.from=mgsn.dev (policy=none); spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Spam-Score: 3.68 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=mgsn.dev header.s=key1 header.b=Iqs1blDc; dmarc=fail reason="SPF not aligned (relaxed)" header.from=mgsn.dev (policy=none); spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Queue-Id: D8BD18A21 X-Spam-Score: 3.68 X-Migadu-Scanner: scn0.migadu.com X-TUID: rf/E9cLP/ZEb * 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