From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Taylor R Campbell Newsgroups: gmane.lisp.guile.bugs Subject: bug#54915: [PATCH] Guile rejects empty vendor in GNU triplets, as used by NetBSD Date: Wed, 13 Apr 2022 11:26:44 +0000 Message-ID: <20220413112644.6016B60859@jupiter.mumble.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=_Jk88w0qeZbZBxabcXkD5GbHSqAbVNpLw" Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="32784"; mail-complaints-to="usenet@ciao.gmane.io" To: 54915@debbugs.gnu.org Original-X-From: bug-guile-bounces+guile-bugs=m.gmane-mx.org@gnu.org Wed Apr 13 17:31:31 2022 Return-path: Envelope-to: guile-bugs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1neexv-0008Le-CH for guile-bugs@m.gmane-mx.org; Wed, 13 Apr 2022 17:31:31 +0200 Original-Received: from localhost ([::1]:48652 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1neexu-00066v-1u for guile-bugs@m.gmane-mx.org; Wed, 13 Apr 2022 11:31:30 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:39426) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1neexT-00066O-N9 for bug-guile@gnu.org; Wed, 13 Apr 2022 11:31:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:59772) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1neexT-0008Lj-D2 for bug-guile@gnu.org; Wed, 13 Apr 2022 11:31:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1neexT-0006VM-Aa for bug-guile@gnu.org; Wed, 13 Apr 2022 11:31:03 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Taylor R Campbell Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Wed, 13 Apr 2022 15:31:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 54915 X-GNU-PR-Package: guile X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-guile@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.164986385724952 (code B ref -1); Wed, 13 Apr 2022 15:31:03 +0000 Original-Received: (at submit) by debbugs.gnu.org; 13 Apr 2022 15:30:57 +0000 Original-Received: from localhost ([127.0.0.1]:53663 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1neexM-0006UI-Ne for submit@debbugs.gnu.org; Wed, 13 Apr 2022 11:30:57 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:45728) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nebAY-0000mD-A5 for submit@debbugs.gnu.org; Wed, 13 Apr 2022 07:28:18 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:43988) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nebAY-0001su-42 for bug-guile@gnu.org; Wed, 13 Apr 2022 07:28:18 -0400 Original-Received: from jupiter.mumble.net ([74.50.56.165]:46644) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nebAV-0001an-2F for bug-guile@gnu.org; Wed, 13 Apr 2022 07:28:17 -0400 Original-Received: by jupiter.mumble.net (Postfix, from userid 1014) id 6016B60859; Wed, 13 Apr 2022 11:26:44 +0000 (UTC) Received-SPF: pass client-ip=74.50.56.165; envelope-from=campbell@mumble.net; helo=jupiter.mumble.net X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01, T_TVD_MIME_NO_HEADERS=0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Wed, 13 Apr 2022 11:30:54 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-guile@gnu.org List-Id: "Bug reports for GUILE, GNU's Ubiquitous Extension Language" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guile-bounces+guile-bugs=m.gmane-mx.org@gnu.org Original-Sender: "bug-guile" Xref: news.gmane.io gmane.lisp.guile.bugs:10276 Archived-At: This is a multi-part message in MIME format. --=_Jk88w0qeZbZBxabcXkD5GbHSqAbVNpLw NetBSD uses an empty vendor string in a GNU target triplet, like `x86_64--netbsd' or `armv7--netbsdelf-eabihf'; it's been like this since the mid-'90s. (Before that, NetBSD omitted the vendor altogether, so if x86_64 existed then it might have been `x86_64-netbsd'.) This runs afoul of a rule in guile's validate-target in module/system/base/target.scm that requires all components to be nonempty, so pkgsrc's guile build has been carrying around a workaround -- just for guile, not for any other packages I know of -- for ages. Without the workaround in pkgsrc: > BOOTSTRAP(stage0) GUILEC ice-9/eval.go > Backtrace: > 7 (apply-smob/1 # # ?) > 6 (apply-smob/1 #) > 5 (apply-smob/0 #) > 4 (primitive-eval ((@ (ice-9 control) %) (begin (# #) ?))) > 3 (apply-smob/1 #) > 2 (apply-smob/1 #) > 1 (scm-error misc-error #f "~A ~S" ("invalid target" "?") #) > 0 (apply-smob/1 # # #f ?) > > ERROR: In procedure apply-smob/1: > invalid target "x86_64--netbsd" The attached patch relaxes validate-target so it accepts an empty vendor string (but still requires all other components to be nonempty as before). With the patch and without the workaround in pkgsrc, guile builds happily. --=_Jk88w0qeZbZBxabcXkD5GbHSqAbVNpLw Content-Type: text/plain; charset="ISO-8859-1"; name="emptyvendor" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="emptyvendor.patch" >From 12440a85559c3de5e6bced9c9377f3d5d7f5948e Mon Sep 17 00:00:00 2001 From: Taylor R Campbell Date: Wed, 13 Apr 2022 09:51:08 +0000 Subject: [PATCH] Allow empty vendor string in GNU target triplets. NetBSD and pkgsrc have been using an empty vendor string since the mid-'90s, such as x86_64--netbsd. pkgsrc has been carrying around a workaround just the guile build for a long time. (Before that, NetBSD omitted the vendor altogether, so if x86_64 existed then it might have been `x86_64-netbsd', but that caused more problems.) This change makes Guile accept an empty vendor string so workarounds are no longer necessary. * module/system/base/target.scm (validate-target): Allow empty vendor string in GNU target triplets. --- module/system/base/target.scm | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/module/system/base/target.scm b/module/system/base/target.scm index 74af64b9d..87ab5b0c4 100644 --- a/module/system/base/target.scm +++ b/module/system/base/target.scm @@ -53,7 +53,14 @@ (if (or (not (string? target)) (let ((parts (string-split target #\-))) (or (< (length parts) 3) - (or-map string-null? parts)))) + (let ((cpu (list-ref parts 0)) + (os (list-ref parts 2))) + (or (string-null? cpu) + ;; vendor (parts[1]) may be empty + (string-null? os) + ;; optional components (ABI) should be nonempty if + ;; specified + (or-map string-null? (list-tail parts 3))))))) (error "invalid target" target))) =20 (define (with-target target thunk) --=_Jk88w0qeZbZBxabcXkD5GbHSqAbVNpLw--