From unknown Sat Jun 21 03:23:58 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#49305 <49305@debbugs.gnu.org> To: bug#49305 <49305@debbugs.gnu.org> Subject: Status: Regression regarding #nil in syntax expansions in 3.0.7 Reply-To: bug#49305 <49305@debbugs.gnu.org> Date: Sat, 21 Jun 2025 10:23:58 +0000 retitle 49305 Regression regarding #nil in syntax expansions in 3.0.7 reassign 49305 guile submitter 49305 Rob Browning severity 49305 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Wed Jun 30 19:48:40 2021 Received: (at submit) by debbugs.gnu.org; 30 Jun 2021 23:48:40 +0000 Received: from localhost ([127.0.0.1]:59064 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lyjwe-0003LY-2r for submit@debbugs.gnu.org; Wed, 30 Jun 2021 19:48:40 -0400 Received: from lists.gnu.org ([209.51.188.17]:49002) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lyjwc-0003LQ-NZ for submit@debbugs.gnu.org; Wed, 30 Jun 2021 19:48:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47586) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lyjwa-0006R8-Pf for bug-guile@gnu.org; Wed, 30 Jun 2021 19:48:38 -0400 Received: from defaultvalue.org ([45.33.119.55]:44236) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lyjwZ-0005FQ-26 for bug-guile@gnu.org; Wed, 30 Jun 2021 19:48:36 -0400 Received: from trouble.defaultvalue.org (localhost [127.0.0.1]) (Authenticated sender: rlb@defaultvalue.org) by defaultvalue.org (Postfix) with ESMTPSA id 0E366200F3 for ; Wed, 30 Jun 2021 18:48:03 -0500 (CDT) Received: by trouble.defaultvalue.org (Postfix, from userid 1000) id 6087614E48D; Wed, 30 Jun 2021 18:48:02 -0500 (CDT) From: Rob Browning To: bug-guile@gnu.org Subject: Regression regarding #nil in syntax expansions in 3.0.7 Date: Wed, 30 Jun 2021 18:48:02 -0500 Message-ID: <87eecididp.fsf@trouble.defaultvalue.org> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=45.33.119.55; envelope-from=rlb@defaultvalue.org; helo=defaultvalue.org 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_PASS=-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 (--) In 3.0.7, this: (define-syntax foo (syntax-rules () ((_ x) (eq? #nil x)))) (foo #t) began crashing like this: ice-9/psyntax.scm:2795:12: In procedure syntax-violation: Syntax error: unknown location: unexpected syntax in form () git bisect suggested the source of the trouble might be this change: commit 0cc799185576712d69f11fc794454f2f5447bef7 Date: Thu Feb 25 09:33:15 2021 +0100 Ensure that (syntax ()) results in () * module/ice-9/psyntax.scm: Add a special case for (). There are already special cases for pairs, vectors, etc; the issue is that with read-syntax, the () might be come into psyntax as an annotated syntax object, which here we would want to strip, to preserve the invariant to psyntax users that all lists are unwrapped. And this change to the same code appears to fix the problem, while still passing all the existing tests (the assumption being that we might need to special case #nil too): diff --git a/module/ice-9/psyntax.scm b/module/ice-9/psyntax.scm index 663d9275a..bd4bd6723 100644 --- a/module/ice-9/psyntax.scm +++ b/module/ice-9/psyntax.scm @@ -2157,6 +2157,7 @@ (lambda () (gen-syntax src #'(e1 e2 ...) r maps ellipsis? mod)) (lambda (e maps) (values (gen-vector e) maps)))) + (x (eq? (syntax->datum #'x) #nil) (values '(quote #nil) maps)) (() (values '(quote ()) maps)) (_ (values `(quote ,e) maps)))))) diff --git a/test-suite/tests/syntax.test b/test-suite/tests/syntax.test index a2999ac43..510e7104d 100644 --- a/test-suite/tests/syntax.test +++ b/test-suite/tests/syntax.test @@ -1684,6 +1684,16 @@ (hash interpreted most-positive-fixnum) (hash compiled most-positive-fixnum)))) +(with-test-prefix "#nil in syntaxes" + (pass-if-equal "does not crash" + 42 + (let () + (define-syntax foo + (syntax-rules () + ;; In 3.0.7 this would crash with + ;; unknown location: unexpected syntax in form () + ((_ x) (when (eq? x #nil) 42)))) + (foo #nil)))) ;;; Local Variables: ;;; eval: (put 'pass-if-syntax-error 'scheme-indent-function 1) So I wondered whether this might be a plausible fix. (I originally noticed because it breaks lokke, which like the elisp dialect, depends more heavily on #nil.) Thanks -- Rob Browning rlb @defaultvalue.org and @debian.org GPG as of 2011-07-10 E6A9 DA3C C9FD 1FF8 C676 D2C4 C0F0 39E9 ED1B 597A GPG as of 2002-11-03 14DD 432F AE39 534D B592 F9A0 25C8 D377 8C7E 73A4 From debbugs-submit-bounces@debbugs.gnu.org Sun Jan 12 13:31:54 2025 Received: (at 49305-done) by debbugs.gnu.org; 12 Jan 2025 18:31:54 +0000 Received: from localhost ([127.0.0.1]:49069 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tX2kb-0007NA-Oh for submit@debbugs.gnu.org; Sun, 12 Jan 2025 13:31:53 -0500 Received: from defaultvalue.org ([45.33.119.55]:41648) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tX2ka-0007N1-2K for 49305-done@debbugs.gnu.org; Sun, 12 Jan 2025 13:31:52 -0500 Received: from trouble.defaultvalue.org (localhost [127.0.0.1]) (Authenticated sender: rlb@defaultvalue.org) by defaultvalue.org (Postfix) with ESMTPSA id CAE19200CC for <49305-done@debbugs.gnu.org>; Sun, 12 Jan 2025 12:31:51 -0600 (CST) Received: by trouble.defaultvalue.org (Postfix, from userid 1000) id 725F614E066; Sun, 12 Jan 2025 12:31:51 -0600 (CST) From: Rob Browning To: 49305-done@debbugs.gnu.org Subject: Re: bug#49305: Regression regarding #nil in syntax expansions in 3.0.7 In-Reply-To: <87eecididp.fsf@trouble.defaultvalue.org> (Rob Browning's message of "Wed, 30 Jun 2021 18:48:02 -0500") References: <87eecididp.fsf@trouble.defaultvalue.org> Date: Sun, 12 Jan 2025 12:31:51 -0600 Message-ID: <877c6z9948.fsf@trouble.defaultvalue.org> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 49305-done 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 (-) Rob Browning writes: > In 3.0.7, this: > > (define-syntax foo > (syntax-rules () > ((_ x) (eq? #nil x)))) > > (foo #t) > > began crashing like this: > > ice-9/psyntax.scm:2795:12: In procedure syntax-violation: > Syntax error: > unknown location: unexpected syntax in form () I believe this has been fixed. Thanks -- Rob Browning rlb @defaultvalue.org and @debian.org GPG as of 2011-07-10 E6A9 DA3C C9FD 1FF8 C676 D2C4 C0F0 39E9 ED1B 597A GPG as of 2002-11-03 14DD 432F AE39 534D B592 F9A0 25C8 D377 8C7E 73A4 From unknown Sat Jun 21 03:23:58 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Mon, 10 Feb 2025 12:24:06 +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