From unknown Sun Sep 07 16:50:47 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#40643] [PATCH] git-version: Handle invalid arguments gracefully Resent-From: Jakub =?UTF-8?Q?K=C4=85dzio=C5=82ka?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 15 Apr 2020 15:19:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 40643 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 40643@debbugs.gnu.org X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.15869639246301 (code B ref -1); Wed, 15 Apr 2020 15:19:01 +0000 Received: (at submit) by debbugs.gnu.org; 15 Apr 2020 15:18:44 +0000 Received: from localhost ([127.0.0.1]:36935 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jOjoJ-0001dZ-Jz for submit@debbugs.gnu.org; Wed, 15 Apr 2020 11:18:43 -0400 Received: from lists.gnu.org ([209.51.188.17]:57140) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jOjoI-0001dR-16 for submit@debbugs.gnu.org; Wed, 15 Apr 2020 11:18:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54536) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jOjoG-0002OE-NF for guix-patches@gnu.org; Wed, 15 Apr 2020 11:18:41 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,RCVD_IN_DNSWL_NONE, URIBL_BLOCKED autolearn=disabled version=3.3.2 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jOjoF-0000pQ-0s for guix-patches@gnu.org; Wed, 15 Apr 2020 11:18:40 -0400 Received: from pat.zlotemysli.pl ([37.59.186.212]:36144) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1jOjoE-0000nY-Nr for guix-patches@gnu.org; Wed, 15 Apr 2020 11:18:38 -0400 Received: (qmail 1219 invoked by uid 1009); 15 Apr 2020 17:18:29 +0200 Received: from 188.123.215.55 (kuba@kadziolka.net@188.123.215.55) by pat (envelope-from , uid 1002) with qmail-scanner-2.08st (clamdscan: 0.98.6/25782. spamassassin: 3.4.0. perlscan: 2.08st. Clear:RC:1(188.123.215.55):. Processed in 0.022798 secs); 15 Apr 2020 15:18:29 -0000 Received: from unknown (HELO localhost.localdomain) (kuba@kadziolka.net@188.123.215.55) by pat.zlotemysli.pl with AES256-SHA encrypted SMTP; 15 Apr 2020 17:18:29 +0200 From: Jakub =?UTF-8?Q?K=C4=85dzio=C5=82ka?= Date: Wed, 15 Apr 2020 17:18:23 +0200 Message-Id: <20200415151824.22988-1-kuba@kadziolka.net> X-Mailer: git-send-email 2.26.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 37.59.186.212 X-Spam-Score: -0.7 (/) 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: -1.7 (-) * guix/git-download.scm (git-version): Add a check for commit ID length. --- If you're curious for the motivation, see [1]. This took a while to debug, so I'm hoping to ease this for the next person who inevitably stumbles upon this. Is a change like this okay? [1]: http://logs.guix.gnu.org/guix/2020-04-14.log#162809 guix/git-download.scm | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/guix/git-download.scm b/guix/git-download.scm index 1eae035fc4..40d81c72b9 100644 --- a/guix/git-download.scm +++ b/guix/git-download.scm @@ -2,6 +2,7 @@ ;;; Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Ludovic Courtès ;;; Copyright © 2017 Mathieu Lirzin ;;; Copyright © 2017 Christopher Baines +;;; Copyright © 2020 Jakub Kądziołka ;;; ;;; This file is part of GNU Guix. ;;; @@ -30,6 +31,7 @@ #:use-module (ice-9 match) #:use-module (ice-9 vlist) #:use-module (srfi srfi-1) + #:use-module (srfi srfi-35) #:export (git-reference git-reference? git-reference-url @@ -170,6 +172,13 @@ HASH-ALGO (a symbol). Use NAME as the file name, or a generic name if #f." (define (git-version version revision commit) "Return the version string for packages using git-download." + ;; git-version is almost exclusively executed while modules are being loaded. + ;; This makes any errors hide their backtrace. Avoid the mysterious error + ;; "Value out of range 0 to N: 7" when the commit ID is too short, which + ;; can happen, for example, when the user swapped the revision and commit + ;; arguments by mistake. + (when (< (string-length commit) 7) + (error "git-version: commit ID unexpectedly short")) (string-append version "-" revision "." (string-take commit 7))) (define (git-file-name name version) -- 2.26.0 From unknown Sun Sep 07 16:50:47 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#40643] [PATCH] git-version: Handle invalid arguments gracefully Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 17 Apr 2020 21:17:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 40643 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Jakub =?UTF-8?Q?K=C4=85dzio=C5=82ka?= Cc: 40643@debbugs.gnu.org Received: via spool by 40643-submit@debbugs.gnu.org id=B40643.15871582172491 (code B ref 40643); Fri, 17 Apr 2020 21:17:01 +0000 Received: (at 40643) by debbugs.gnu.org; 17 Apr 2020 21:16:57 +0000 Received: from localhost ([127.0.0.1]:41816 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jPYM5-0000e6-Dj for submit@debbugs.gnu.org; Fri, 17 Apr 2020 17:16:57 -0400 Received: from eggs.gnu.org ([209.51.188.92]:57542) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jPYM4-0000dr-KP for 40643@debbugs.gnu.org; Fri, 17 Apr 2020 17:16:56 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:45949) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1jPYLx-0007X7-6E; Fri, 17 Apr 2020 17:16:49 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=53580 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1jPYLt-0003vD-UK; Fri, 17 Apr 2020 17:16:47 -0400 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <20200415151824.22988-1-kuba@kadziolka.net> Date: Fri, 17 Apr 2020 23:16:44 +0200 In-Reply-To: <20200415151824.22988-1-kuba@kadziolka.net> ("Jakub \=\?utf-8\?B\?S8SFZHppb8WCa2EiJ3M\=\?\= message of "Wed, 15 Apr 2020 17:18:23 +0200") Message-ID: <87v9lx95j7.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: -1.5 (-) 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.5 (--) Hi Jakub, Jakub K=C4=85dzio=C5=82ka skribis: > * guix/git-download.scm (git-version): Add a check for commit ID length. > --- > If you're curious for the motivation, see [1]. This took a while to > debug, so I'm hoping to ease this for the next person who inevitably > stumbles upon this. Is a change like this okay? Yes, I think so. The =E2=80=98error=E2=80=99 procedure is not great, we wo= uld rather use =E2=80=98raise=E2=80=99 with a =E2=80=98&message=E2=80=99 condition (wh= ich additionally allows for i18n) but it=E2=80=99s no big deal here. Thanks, Ludo=E2=80=99. From unknown Sun Sep 07 16:50:47 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#40643] [PATCH] git-version: Handle invalid arguments gracefully Resent-From: Jakub =?UTF-8?Q?K=C4=85dzio=C5=82ka?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 21 Apr 2020 22:46:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 40643 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: 40643@debbugs.gnu.org Received: via spool by 40643-submit@debbugs.gnu.org id=B40643.158750915028353 (code B ref 40643); Tue, 21 Apr 2020 22:46:01 +0000 Received: (at 40643) by debbugs.gnu.org; 21 Apr 2020 22:45:50 +0000 Received: from localhost ([127.0.0.1]:50914 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jR1eI-0007NF-Cg for submit@debbugs.gnu.org; Tue, 21 Apr 2020 18:45:50 -0400 Received: from pat.zlotemysli.pl ([37.59.186.212]:39976) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jR1eH-0007N7-3n for 40643@debbugs.gnu.org; Tue, 21 Apr 2020 18:45:49 -0400 Received: (qmail 4740 invoked by uid 1009); 22 Apr 2020 00:45:47 +0200 Received: from 188.123.215.55 (kuba@kadziolka.net@188.123.215.55) by pat (envelope-from , uid 1002) with qmail-scanner-2.08st (clamdscan: 0.98.6/25788. spamassassin: 3.4.0. perlscan: 2.08st. Clear:RC:1(188.123.215.55):. Processed in 0.023322 secs); 21 Apr 2020 22:45:47 -0000 Received: from unknown (HELO gravity) (kuba@kadziolka.net@188.123.215.55) by pat.zlotemysli.pl with SMTP; 22 Apr 2020 00:45:47 +0200 Date: Wed, 22 Apr 2020 00:45:45 +0200 From: Jakub =?UTF-8?Q?K=C4=85dzio=C5=82ka?= Message-ID: <20200421224545.ztr7beu3mqaufyo3@gravity> References: <20200415151824.22988-1-kuba@kadziolka.net> <87v9lx95j7.fsf@gnu.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="ru4324lpjy2dzlq4" Content-Disposition: inline In-Reply-To: <87v9lx95j7.fsf@gnu.org> X-Spam-Score: 0.0 (/) 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: -1.0 (-) --ru4324lpjy2dzlq4 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Apr 17, 2020 at 11:16:44PM +0200, Ludovic Court=C3=A8s wrote: > Hi Jakub, >=20 > Jakub K=C4=85dzio=C5=82ka skribis: >=20 > > * guix/git-download.scm (git-version): Add a check for commit ID length. > > --- > > If you're curious for the motivation, see [1]. This took a while to > > debug, so I'm hoping to ease this for the next person who inevitably > > stumbles upon this. Is a change like this okay? >=20 > Yes, I think so. The =E2=80=98error=E2=80=99 procedure is not great, we = would rather > use =E2=80=98raise=E2=80=99 with a =E2=80=98&message=E2=80=99 condition (= which additionally allows for > i18n) but it=E2=80=99s no big deal here. I considered using raise instead, but I couldn't get it to work properly. I was getting a "Wrong type (expecting exact integer)" error instead: (raise (condition (&message (message "git-version: commit ID unexpectedly short")))) Do you know why that might be? Regards, Jakub K=C4=85dzio=C5=82ka --ru4324lpjy2dzlq4 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEE5Xa/ss9usT31cTO54xWnWEYTFWQFAl6fd5MACgkQ4xWnWEYT FWRU1BAAjPJ6kRmZHq80VzCFfpao+YGAcQoOo/jX4RrYl9SOwvMfTKTV1rf1jv/2 7QV4Z/q6jg7xPcBkuPL2M+BZB8P3ELlRnTQPZcPhojYEb7R4u+C+7r3otSb8L26V sNEHXCjbUbgHdKMBgAU48oAHtT6cFgFOo5h7Lnkz6JwIUU1K65VOAuh7O30UI9bm dfgNnIUh0RRT8jLSkcUqsCC90XdwEs/jxTihIzMwoFIWRBdWj17lgUtoQWSQjd00 pX2QidfKaYr7fxJgY7qiG/0hTFwLBkpduIRmFB48Btoc+eeEEWAvmcV4ShBz2pjE 1RQQsP3u73x0SOOAWKBjegA3xXmtbZwzVrmJgXYeyXFxukGMhYOIpSEQDQYQE45j u6A6mE3NbzaPUJGtaA6xOBr4P7YOccg35C2ZsdtKHNopRDaLgcKnol8vaitADsNB u8mO3F1V32TpGXovtifZz992INEzuym2zR/SrgAC3OS9DbKQpbVLqA78PxfIJDT0 QEuXF5oAdpDzvyLkZPpTxKd2hIECTM37r/FPl8TH5FFzLlpAUZFXJAeXFilqrbJD im/Te1lQ0bTPpYmSIXBdcat3ZdBnjYAC5WzwYuSkhPl3w7iaj168MT243e8umH5X HT1Q+/nZlfA2mkLadpA+rxRTxvO1PLbz0B2HAOxSSLG2upH7OA8= =81vp -----END PGP SIGNATURE----- --ru4324lpjy2dzlq4-- From unknown Sun Sep 07 16:50:47 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#40643] [PATCH] git-version: Handle invalid arguments gracefully Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 22 Apr 2020 15:11:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 40643 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Jakub =?UTF-8?Q?K=C4=85dzio=C5=82ka?= Cc: 40643@debbugs.gnu.org Received: via spool by 40643-submit@debbugs.gnu.org id=B40643.15875682304406 (code B ref 40643); Wed, 22 Apr 2020 15:11:01 +0000 Received: (at 40643) by debbugs.gnu.org; 22 Apr 2020 15:10:30 +0000 Received: from localhost ([127.0.0.1]:52877 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jRH1C-00018z-J0 for submit@debbugs.gnu.org; Wed, 22 Apr 2020 11:10:30 -0400 Received: from eggs.gnu.org ([209.51.188.92]:56446) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jRH1A-00018n-Jd for 40643@debbugs.gnu.org; Wed, 22 Apr 2020 11:10:28 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:60014) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jRH14-0002Sg-UL; Wed, 22 Apr 2020 11:10:23 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=52532 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1jRH12-0002LB-Da; Wed, 22 Apr 2020 11:10:21 -0400 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <20200415151824.22988-1-kuba@kadziolka.net> <87v9lx95j7.fsf@gnu.org> <20200421224545.ztr7beu3mqaufyo3@gravity> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 4 =?UTF-8?Q?Flor=C3=A9al?= an 228 de la =?UTF-8?Q?R=C3=A9volution?= X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu Date: Wed, 22 Apr 2020 17:10:18 +0200 In-Reply-To: <20200421224545.ztr7beu3mqaufyo3@gravity> ("Jakub \=\?utf-8\?B\?S8SFZHppb8WCa2EiJ3M\=\?\= message of "Wed, 22 Apr 2020 00:45:45 +0200") Message-ID: <87pnbzwo85.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.7 (/) 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: -1.7 (-) Hi, Jakub K=C4=85dzio=C5=82ka skribis: > On Fri, Apr 17, 2020 at 11:16:44PM +0200, Ludovic Court=C3=A8s wrote: >> Hi Jakub, >>=20 >> Jakub K=C4=85dzio=C5=82ka skribis: >>=20 >> > * guix/git-download.scm (git-version): Add a check for commit ID lengt= h. >> > --- >> > If you're curious for the motivation, see [1]. This took a while to >> > debug, so I'm hoping to ease this for the next person who inevitably >> > stumbles upon this. Is a change like this okay? >>=20 >> Yes, I think so. The =E2=80=98error=E2=80=99 procedure is not great, we= would rather >> use =E2=80=98raise=E2=80=99 with a =E2=80=98&message=E2=80=99 condition = (which additionally allows for >> i18n) but it=E2=80=99s no big deal here. > > I considered using raise instead, but I couldn't get it to work > properly. I was getting a "Wrong type (expecting exact integer)" error > instead: > > (raise > (condition (&message > (message "git-version: commit ID unexpectedly short")))) > > Do you know why that might be? It must be because you forgot to include (srfi srfi-34): there are two =E2=80=98raise=E2=80=99 procedure, and in core Guile =E2=80=98raise=E2=80= =99 is about signals, not error conditions. HTH! Ludo=E2=80=99. From unknown Sun Sep 07 16:50:47 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Jakub =?UTF-8?Q?K=C4=85dzio=C5=82ka?= Subject: bug#40643: closed (Re: [bug#40643] [PATCH] git-version: Handle invalid arguments gracefully) Message-ID: References: <20200423133201.7cif3mwfdotazedt@gravity> <20200415151824.22988-1-kuba@kadziolka.net> X-Gnu-PR-Message: they-closed 40643 X-Gnu-PR-Package: guix-patches X-Gnu-PR-Keywords: patch Reply-To: 40643@debbugs.gnu.org Date: Thu, 23 Apr 2020 13:33:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1587648782-22836-1" This is a multi-part message in MIME format... ------------=_1587648782-22836-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #40643: [PATCH] git-version: Handle invalid arguments gracefully which was filed against the guix-patches package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 40643@debbugs.gnu.org. --=20 40643: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D40643 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1587648782-22836-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 40643-done) by debbugs.gnu.org; 23 Apr 2020 13:32:07 +0000 Received: from localhost ([127.0.0.1]:54274 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jRbxX-0005uk-Hw for submit@debbugs.gnu.org; Thu, 23 Apr 2020 09:32:07 -0400 Received: from pat.zlotemysli.pl ([37.59.186.212]:56064) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jRbxV-0005uU-8F for 40643-done@debbugs.gnu.org; Thu, 23 Apr 2020 09:32:05 -0400 Received: (qmail 837 invoked by uid 1009); 23 Apr 2020 15:32:03 +0200 Received: from 188.123.215.55 (kuba@kadziolka.net@188.123.215.55) by pat (envelope-from , uid 1002) with qmail-scanner-2.08st (clamdscan: 0.98.6/25790. spamassassin: 3.4.0. perlscan: 2.08st. Clear:RC:1(188.123.215.55):. Processed in 0.02106 secs); 23 Apr 2020 13:32:03 -0000 Received: from unknown (HELO gravity) (kuba@kadziolka.net@188.123.215.55) by pat.zlotemysli.pl with SMTP; 23 Apr 2020 15:32:03 +0200 Date: Thu, 23 Apr 2020 15:32:01 +0200 From: Jakub =?utf-8?B?S8SFZHppb8WCa2E=?= To: Ludovic =?utf-8?Q?Court=C3=A8s?= Subject: Re: [bug#40643] [PATCH] git-version: Handle invalid arguments gracefully Message-ID: <20200423133201.7cif3mwfdotazedt@gravity> References: <20200415151824.22988-1-kuba@kadziolka.net> <87v9lx95j7.fsf@gnu.org> <20200421224545.ztr7beu3mqaufyo3@gravity> <87pnbzwo85.fsf@gnu.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="4ue6jgknhzaku74h" Content-Disposition: inline In-Reply-To: <87pnbzwo85.fsf@gnu.org> X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 40643-done Cc: 40643-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: -1.0 (-) --4ue6jgknhzaku74h Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Apr 22, 2020 at 05:10:18PM +0200, Ludovic Court=C3=A8s wrote: > It must be because you forgot to include (srfi srfi-34): there are two > =E2=80=98raise=E2=80=99 procedure, and in core Guile =E2=80=98raise=E2=80= =99 is about signals, not error > conditions. Thanks! That did it! I pushed an updated patch. Regards, Jakub K=C4=85dzio=C5=82ka --4ue6jgknhzaku74h Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEE5Xa/ss9usT31cTO54xWnWEYTFWQFAl6hmM0ACgkQ4xWnWEYT FWQsBA//TB4DOC0ZBqNdfhdS1Z0T8U0AfgJP40NhPwNMoEIpt3CE+rPvuOY5weAq PpJkQraWo0icPYLvvxqwT9s1b7AVqhrkMm+EVjhY3ggmBvl4dzT3NAS5M84qBQQ8 3xcPTClVo5sHFeo/6Q7cR3SevA/fNR764QKlQN++ie4bW+k48snDy+ZnB2qIzp9x HpUFuWtN4ljV17Fw7sLSQIZ+vzBL/p/FL67dntvOOtqFn2lD5k1qZJ7xh7yHI8iw TZnBXsTNAqGmpaR8xlZzyoXTgZt0PylzLPFODFK4oTK4+R3Dqb3mamTI6zk6G1wx SjwVTUypqsIvFYpAHyeFfThFO2CxOHNIpfv/DaquH1Suiksf6+9098AUZFdoDvB4 zBugRWjOA/zt0iS7iRFtKKHV7Q3vsqirrcy6QvD9wwiYVIaClbK4Gz0qM5yag27+ XLkqSbO3D4Tps46ewvEQomVh/6yqCodyhZg3dxikUUAkN5s3t5rA0H3ta6RpW1Oc 5AfdbV5Mg/YXh8Ur9eBS11PRzGB54owxzClg3d7EsZ0uJwrZGWGKvNF6Y8vjoQb4 /hXDS5p5n6wkAN/TuftbjvHAKwmHetyT35UvIsZXNBjHSGfYQLCbbGcMDXEbO8sD jXqek54w2vIgOvy4lZ1CKjJA0A5kygqNxNDi+G3t0y+AWPRZNLQ= =3eo/ -----END PGP SIGNATURE----- --4ue6jgknhzaku74h-- ------------=_1587648782-22836-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 15 Apr 2020 15:18:44 +0000 Received: from localhost ([127.0.0.1]:36935 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jOjoJ-0001dZ-Jz for submit@debbugs.gnu.org; Wed, 15 Apr 2020 11:18:43 -0400 Received: from lists.gnu.org ([209.51.188.17]:57140) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jOjoI-0001dR-16 for submit@debbugs.gnu.org; Wed, 15 Apr 2020 11:18:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54536) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jOjoG-0002OE-NF for guix-patches@gnu.org; Wed, 15 Apr 2020 11:18:41 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,RCVD_IN_DNSWL_NONE, URIBL_BLOCKED autolearn=disabled version=3.3.2 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jOjoF-0000pQ-0s for guix-patches@gnu.org; Wed, 15 Apr 2020 11:18:40 -0400 Received: from pat.zlotemysli.pl ([37.59.186.212]:36144) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1jOjoE-0000nY-Nr for guix-patches@gnu.org; Wed, 15 Apr 2020 11:18:38 -0400 Received: (qmail 1219 invoked by uid 1009); 15 Apr 2020 17:18:29 +0200 Received: from 188.123.215.55 (kuba@kadziolka.net@188.123.215.55) by pat (envelope-from , uid 1002) with qmail-scanner-2.08st (clamdscan: 0.98.6/25782. spamassassin: 3.4.0. perlscan: 2.08st. Clear:RC:1(188.123.215.55):. Processed in 0.022798 secs); 15 Apr 2020 15:18:29 -0000 Received: from unknown (HELO localhost.localdomain) (kuba@kadziolka.net@188.123.215.55) by pat.zlotemysli.pl with AES256-SHA encrypted SMTP; 15 Apr 2020 17:18:29 +0200 From: =?UTF-8?q?Jakub=20K=C4=85dzio=C5=82ka?= To: guix-patches@gnu.org Subject: [PATCH] git-version: Handle invalid arguments gracefully Date: Wed, 15 Apr 2020 17:18:23 +0200 Message-Id: <20200415151824.22988-1-kuba@kadziolka.net> X-Mailer: git-send-email 2.26.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 37.59.186.212 X-Spam-Score: -0.7 (/) 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: -1.7 (-) * guix/git-download.scm (git-version): Add a check for commit ID length. --- If you're curious for the motivation, see [1]. This took a while to debug, so I'm hoping to ease this for the next person who inevitably stumbles upon this. Is a change like this okay? [1]: http://logs.guix.gnu.org/guix/2020-04-14.log#162809 guix/git-download.scm | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/guix/git-download.scm b/guix/git-download.scm index 1eae035fc4..40d81c72b9 100644 --- a/guix/git-download.scm +++ b/guix/git-download.scm @@ -2,6 +2,7 @@ ;;; Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Ludovic Courtès ;;; Copyright © 2017 Mathieu Lirzin ;;; Copyright © 2017 Christopher Baines +;;; Copyright © 2020 Jakub Kądziołka ;;; ;;; This file is part of GNU Guix. ;;; @@ -30,6 +31,7 @@ #:use-module (ice-9 match) #:use-module (ice-9 vlist) #:use-module (srfi srfi-1) + #:use-module (srfi srfi-35) #:export (git-reference git-reference? git-reference-url @@ -170,6 +172,13 @@ HASH-ALGO (a symbol). Use NAME as the file name, or a generic name if #f." (define (git-version version revision commit) "Return the version string for packages using git-download." + ;; git-version is almost exclusively executed while modules are being loaded. + ;; This makes any errors hide their backtrace. Avoid the mysterious error + ;; "Value out of range 0 to N: 7" when the commit ID is too short, which + ;; can happen, for example, when the user swapped the revision and commit + ;; arguments by mistake. + (when (< (string-length commit) 7) + (error "git-version: commit ID unexpectedly short")) (string-append version "-" revision "." (string-take commit 7))) (define (git-file-name name version) -- 2.26.0 ------------=_1587648782-22836-1--