From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Ricardo Wurmus Newsgroups: gmane.lisp.guile.bugs Subject: bug#56665: Segfault in SRFI-37 when raising ERROR in ARGS-FOLD. Date: Wed, 20 Jul 2022 16:34:53 +0200 Message-ID: <87y1wnsv2m.fsf@elephly.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="17520"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: mu4e 1.6.11; emacs 28.1 To: 56665@debbugs.gnu.org Original-X-From: bug-guile-bounces+guile-bugs=m.gmane-mx.org@gnu.org Wed Jul 20 16:45:11 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 1oEAwo-0004JR-H5 for guile-bugs@m.gmane-mx.org; Wed, 20 Jul 2022 16:45:10 +0200 Original-Received: from localhost ([::1]:58896 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oEAwn-0004ty-3B for guile-bugs@m.gmane-mx.org; Wed, 20 Jul 2022 10:45:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:55380) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oEAwg-0004ti-8Z for bug-guile@gnu.org; Wed, 20 Jul 2022 10:45:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:60735) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oEAwf-0006Wn-VO for bug-guile@gnu.org; Wed, 20 Jul 2022 10:45:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oEAwf-0003YK-Rb for bug-guile@gnu.org; Wed, 20 Jul 2022 10:45:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Ricardo Wurmus Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Wed, 20 Jul 2022 14:45:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 56665 X-GNU-PR-Package: guile X-Debbugs-Original-To: bug-guile@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.165832825613569 (code B ref -1); Wed, 20 Jul 2022 14:45:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 20 Jul 2022 14:44:16 +0000 Original-Received: from localhost ([127.0.0.1]:58492 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oEAvw-0003Wn-0W for submit@debbugs.gnu.org; Wed, 20 Jul 2022 10:44:16 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:46194) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oEAvt-0003Wf-UB for submit@debbugs.gnu.org; Wed, 20 Jul 2022 10:44:14 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:55238) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oEAvt-0004sZ-PK for bug-guile@gnu.org; Wed, 20 Jul 2022 10:44:13 -0400 Original-Received: from sender4-of-o51.zoho.com ([136.143.188.51]:21177) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oEAvr-0006T6-0E for bug-guile@gnu.org; Wed, 20 Jul 2022 10:44:13 -0400 ARC-Seal: i=1; a=rsa-sha256; t=1658328245; cv=none; d=zohomail.com; s=zohoarc; b=mrFhgYjklOkalqqy5l/eZykZLzDXScvrJ4jDFX1BuxB8ZkpHwL7lyy/N40vG1KpHvSO5ZFs8Olce9UxVZarGH0o3mvzxuZULA06IOlW26h7gGu3AT+7pD14OJCyXY7mEfZlwB986kxlGWU6mtSNcNcVM+m+5bvYe/Tk38iSDYMA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1658328245; h=Content-Type:Content-Transfer-Encoding:Date:From:MIME-Version:Message-ID:Subject:To; bh=Sl9D2p8/WQIvXUe1lB9sg1EySN5iqOvm6TBIBw4BR2k=; b=Ji5muhKdiqS+Cg4BkVHUbZRUhCVPSJ4Acr26pFASDaffJx9z6hI4iLX3jjBOaOzhAQP08yJcSsSs0XOlb2Tps85cwGthYAXNS0MePw6q1GGi5N5p6Ck4/qrm12MumyyrJ2wczwEpUwHwBoYEXv+dPfoRj604bSCtUhtL83AEBjk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=elephly.net; spf=pass smtp.mailfrom=rekado@elephly.net; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1658328245; s=zoho; d=elephly.net; i=rekado@elephly.net; h=From:From:To:To:Subject:Subject:Date:Date:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-Id:Reply-To:Cc; bh=Sl9D2p8/WQIvXUe1lB9sg1EySN5iqOvm6TBIBw4BR2k=; b=IlS8Rpv5ASGJgWro9kmiMxzpoSRJUfD2cfiy79faYewssPZKwbhLDRMILj+nVHEi tSaHIPGPMd1DLFCNuTavIGxTtIIva+EgroaePZlTXlzoXGiMbPqC1FeORCaYfgNz4bW RJLQvut38h1EzpVJ0+q/G2Gp5gggb21/2wXe/Hjc= Original-Received: from localhost (i5E862D20.versanet.de [94.134.45.32]) by mx.zohomail.com with SMTPS id 1658328244226149.0325793555213; Wed, 20 Jul 2022 07:44:04 -0700 (PDT) X-URL: https://elephly.net X-PGP-Key: https://elephly.net/rekado.pubkey X-PGP-Fingerprint: BCA6 89B6 3655 3801 C3C6 2150 197A 5888 235F ACAC X-ZohoMailClient: External Received-SPF: pass client-ip=136.143.188.51; envelope-from=rekado@elephly.net; helo=sender4-of-o51.zoho.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: 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:10304 Archived-At: Hi, I got Guile to segfault in srfi-37. Here=E2=80=99s a Guile script: --8<---------------cut here---------------start------------->8--- #!/run/current-system/profile/bin/guile \ --no-auto-compile !# (use-modules (srfi srfi-1) (srfi srfi-37) (ice-9 match)) (define %options (list (option '("greet") #t #f (lambda (opt name arg result) (alist-cons 'greet arg (alist-delete 'greet result)))))) (define %default-options `((greet . "hello"))) (define (parse-options args) (args-fold args %options (lambda (opt name arg result) (pk 'unrecognized) (error "unrecognized option" name)) (lambda (arg result) (pk 'extraneous) (error "extraneous argument" arg)) %default-options)) (match (pk 'args (program-arguments)) ((_ . rest) (let ((config (parse-options rest))) (pk 'no-segfault))) (_ (pk 'usage))) --8<---------------cut here---------------end--------------->8--- And here is how to make it segfault: --8<---------------cut here---------------start------------->8--- ./segfault.scm --greet=3Dno --oh=3Dcrud ;;; (args ("./segfault.scm" "--greet=3Dno" "--oh=3Dcrud")) ;;; (unrecognized) Backtrace: 4 (primitive-load "/path/to/./segfault.scm") In ice-9/eval.scm: 293:34 3 (_ #(#(#(#(# ("./segfault= .scm" "--greet=3Dno" "--oh=3Dcrud")) #) "./segfault.s= cm" =E2=80=A6) =E2=80=A6)) In srfi/srfi-37.scm: 113:18 2 (next-arg) In unknown file: 1 Segmentation fault --8<---------------cut here---------------end--------------->8--- Looks like using ERROR in ARGS-FOLD leads to a segfault. --=20 Ricardo