From unknown Sun Sep 07 01:28:04 2025 X-Loop: help-debbugs@gnu.org Subject: bug#69749: (bindat-type sint 32 t) -> unbound variable bitlen Resent-From: Eric Marsden Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 12 Mar 2024 15:20:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 69749 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 69749@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.171025678214607 (code B ref -1); Tue, 12 Mar 2024 15:20:02 +0000 Received: (at submit) by debbugs.gnu.org; 12 Mar 2024 15:19:42 +0000 Received: from localhost ([127.0.0.1]:43403 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rk3un-0003nX-HL for submit@debbugs.gnu.org; Tue, 12 Mar 2024 11:19:41 -0400 Received: from lists.gnu.org ([209.51.188.17]:33320) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rk3um-0003nP-7M for submit@debbugs.gnu.org; Tue, 12 Mar 2024 11:19:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rk3uD-0000MO-8R for bug-gnu-emacs@gnu.org; Tue, 12 Mar 2024 11:19:05 -0400 Received: from mail.risk-engineering.org ([2a01:4f8:c0c:a3f8::1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rk3uB-0006Uo-86 for bug-gnu-emacs@gnu.org; Tue, 12 Mar 2024 11:19:05 -0400 DKIM-Signature: a=rsa-sha256; bh=njRrrlc3YOe9ZVWjrEgGRHIv4QpyPlCPoNuJgixqwRU=; c=relaxed/relaxed; d=risk-engineering.org; h=Subject:Subject:Sender:To:To:Cc:From:From:Date:Date:MIME-Version:MIME-Version:Content-Type:Content-Type:Content-Transfer-Encoding:Content-Transfer-Encoding:Reply-To:In-Reply-To:Message-Id:Message-Id:References:Autocrypt:Openpgp; i=@risk-engineering.org; s=default; t=1710256738; v=1; x=1710688738; b=Ba92V4W2ukMTm8r0CkQUkeFpbGf6m8qNBIsCeWjR8H0Xfm0JnxS/8iGIDFHSkqw/SINl3Fem veFyZWqA4kMDZuMi3xRFBVPnIdks4W8J28YrVqSz56/BE3ojeE12k5xLW2PbqMu3MIiiyG/sUUu R4g2+xVfChcPEGKGdM8qlK5ziJGKyIo91z2jGJFENAdrlnLuUB2Hscay91kxlhzLMEtOs02KExn DDlL2QUUB65Fdqwuw/khPr4omGOLEIa3AKTDGtE39KU+GThMIeeS2wyrUPQdZCg+BToyDexES5Z Zff26mRzpdBoxE2EFqehcwhCkVN43FO01nDN1bNDjUxjA== Received: by mail.risk-engineering.org (envelope-sender ) with ESMTPS id 48ff29fc; Tue, 12 Mar 2024 16:18:58 +0100 Message-ID: <82a56165-7684-4f10-a6c4-60ff27de0417@risk-engineering.org> Date: Tue, 12 Mar 2024 16:18:58 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US From: Eric Marsden Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2a01:4f8:c0c:a3f8::1; envelope-from=eric.marsden@risk-engineering.org; helo=mail.risk-engineering.org X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.4 (-) 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 (--) -- file bd.el (require 'bindat) (bindat-pack (bindat-type sint 32 t) 42) -- emacs -Q --batch -l bd.el --> Error: void-variable (bitlen)   mapbacktrace(#f(compiled-function (evald func args flags) #))   debug-early-backtrace()   debug-early(error (void-variable bitlen))   (/ bitlen 8)   (+ bindat-idx (/ bitlen 8))   (setq bindat-idx (+ bindat-idx (/ bitlen 8)))   (let ((v field2)) (setq bindat-idx (+ bindat-idx (/ bitlen 8))))   (let ((field2 (if (< v 0) (+ v wrap) v))) (let ((v field2)) (setq bindat-idx (+ bindat-idx (/ bitlen 8)))))   (let ((v v)) (let ((field2 (if (< v 0) (+ v wrap) v))) (let ((v field2)) (setq bindat-idx (+ bindat-idx (/ bitlen 8))))))   (lambda (v) (let ((v v)) (let ((field2 (if (< v 0) (+ v wrap) v))) (let ((v field2)) (setq bindat-idx (+ bindat-idx (/ bitlen 8)))))))(42)   bindat--length-group(42 #s(bindat--type :le (lambda (v) (let ((v v)) (let ((field2 (if (< v 0) (+ v wrap) v))) (let ((v field2)) (setq bindat-idx (+ bindat-idx (/ bitlen 8))))))) :ue (lambda nil (let ((n (if t (bindat--unpack-uintr bitlen) (bindat--unpack-uint bitlen)))) (if (>= n max) (- n wrap) n))) :pe (lambda (v) (let ((v v)) (let ((field2 (if (< v 0) (+ v wrap) v))) (let ((v field2)) (if t (bindat--pack-uintr bitlen v) (bindat--pack-uint bitlen v))))))))   bindat-length(#s(bindat--type :le (lambda (v) (let ((v v)) (let ((field2 (if (< v 0) (+ v wrap) v))) (let ((v field2)) (setq bindat-idx (+ bindat-idx (/ bitlen 8))))))) :ue (lambda nil (let ((n (if t (bindat--unpack-uintr bitlen) (bindat--unpack-uint bitlen)))) (if (>= n max) (- n wrap) n))) :pe (lambda (v) (let ((v v)) (let ((field2 (if (< v 0) (+ v wrap) v))) (let ((v field2)) (if t (bindat--pack-uintr bitlen v) (bindat--pack-uint bitlen v))))))) 42)   bindat-pack(#s(bindat--type :le (lambda (v) (let ((v v)) (let ((field2 (if (< v 0) (+ v wrap) v))) (let ((v field2)) (setq bindat-idx (+ bindat-idx (/ bitlen 8))))))) :ue (lambda nil (let ((n (if t (bindat--unpack-uintr bitlen) (bindat--unpack-uint bitlen)))) (if (>= n max) (- n wrap) n))) :pe (lambda (v) (let ((v v)) (let ((field2 (if (< v 0) (+ v wrap) v))) (let ((v field2)) (if t (bindat--pack-uintr bitlen v) (bindat--pack-uint bitlen v))))))) 42)   load-with-code-conversion("/tmp/bd.el" "/tmp/bd.el" nil t)   command-line-1(("-l" "/tmp/bd.el"))   command-line()   normal-top-level() Symbol’s value as variable is void: bitlen This bug is difficult to understand. Run from an IELM buffer, this code works as expected. The macroexpansion of the bindat-type declaration includes a binding for bitlen. GNU Emacs 29.2 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.41, cairo version 1.18.0) of 2024-03-09, modified by Debian From unknown Sun Sep 07 01:28:04 2025 X-Loop: help-debbugs@gnu.org Subject: bug#69749: (bindat-type sint 32 t) -> unbound variable bitlen Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 13 Mar 2024 11:54:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69749 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Eric Marsden , Stefan Monnier Cc: 69749@debbugs.gnu.org Received: via spool by 69749-submit@debbugs.gnu.org id=B69749.17103308404028 (code B ref 69749); Wed, 13 Mar 2024 11:54:02 +0000 Received: (at 69749) by debbugs.gnu.org; 13 Mar 2024 11:54:00 +0000 Received: from localhost ([127.0.0.1]:44872 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rkNBI-00012t-73 for submit@debbugs.gnu.org; Wed, 13 Mar 2024 07:54:00 -0400 Received: from eggs.gnu.org ([209.51.188.92]:55760) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rkNBF-00012e-SU for 69749@debbugs.gnu.org; Wed, 13 Mar 2024 07:53:58 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rkNAa-0004IZ-G8; Wed, 13 Mar 2024 07:53:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=/i6w529O/ftsFafMEKOnKocTWFUv0EepphIQPur6GzY=; b=CgMWxJPgo2Utq4C3MR5v UWYuY8YhTiUFFp68NjbLMHwz0J4YqbvfyNjhhU5EWACKutGlfw4m0zh/RFrlnQL42tkdVBMeFnMp7 YRAPh70Dq8q1TFgDyW8It4rUUOt0ogya5vJZzZ6/2GZJu4qfLZnm8zT117TkkF/bpOBfyf32QEvo6 Lm9A6Tio/4GpnNS6pzkr1DewQ6FRofnlEPZa3wE5UE6aYY44O4ZEuY9b9SMrUpPhToyr1CSJK1Fp8 VdhE4FZjdxMmTit2le8HBx4E1MCAGz6CpTFTgTo1+dIfcJgQ8OUfgto4CwMgxIjHzV2CrbPAL5Px/ j0EvPFY3Z0CPCg==; Date: Wed, 13 Mar 2024 13:53:12 +0200 Message-Id: <86cyrytkk7.fsf@gnu.org> From: Eli Zaretskii In-Reply-To: <82a56165-7684-4f10-a6c4-60ff27de0417@risk-engineering.org> (message from Eric Marsden on Tue, 12 Mar 2024 16:18:58 +0100) References: <82a56165-7684-4f10-a6c4-60ff27de0417@risk-engineering.org> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) 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: -3.3 (---) > Date: Tue, 12 Mar 2024 16:18:58 +0100 > From: Eric Marsden > > -- file bd.el > (require 'bindat) > (bindat-pack (bindat-type sint 32 t) 42) > -- > emacs -Q --batch -l bd.el --> > > Error: void-variable (bitlen) >   mapbacktrace(#f(compiled-function (evald func args flags) # -0x160fbb9816517825>)) >   debug-early-backtrace() >   debug-early(error (void-variable bitlen)) >   (/ bitlen 8) >   (+ bindat-idx (/ bitlen 8)) >   (setq bindat-idx (+ bindat-idx (/ bitlen 8))) >   (let ((v field2)) (setq bindat-idx (+ bindat-idx (/ bitlen 8)))) >   (let ((field2 (if (< v 0) (+ v wrap) v))) (let ((v field2)) (setq > bindat-idx (+ bindat-idx (/ bitlen 8))))) >   (let ((v v)) (let ((field2 (if (< v 0) (+ v wrap) v))) (let ((v > field2)) (setq bindat-idx (+ bindat-idx (/ bitlen 8)))))) >   (lambda (v) (let ((v v)) (let ((field2 (if (< v 0) (+ v wrap) v))) > (let ((v field2)) (setq bindat-idx (+ bindat-idx (/ bitlen 8)))))))(42) >   bindat--length-group(42 #s(bindat--type :le (lambda (v) (let ((v v)) > (let ((field2 (if (< v 0) (+ v wrap) v))) (let ((v field2)) (setq > bindat-idx (+ bindat-idx (/ bitlen 8))))))) :ue (lambda nil (let ((n (if > t (bindat--unpack-uintr bitlen) (bindat--unpack-uint bitlen)))) (if (>= > n max) (- n wrap) n))) :pe (lambda (v) (let ((v v)) (let ((field2 (if (< > v 0) (+ v wrap) v))) (let ((v field2)) (if t (bindat--pack-uintr bitlen > v) (bindat--pack-uint bitlen v)))))))) >   bindat-length(#s(bindat--type :le (lambda (v) (let ((v v)) (let > ((field2 (if (< v 0) (+ v wrap) v))) (let ((v field2)) (setq bindat-idx > (+ bindat-idx (/ bitlen 8))))))) :ue (lambda nil (let ((n (if t > (bindat--unpack-uintr bitlen) (bindat--unpack-uint bitlen)))) (if (>= n > max) (- n wrap) n))) :pe (lambda (v) (let ((v v)) (let ((field2 (if (< v > 0) (+ v wrap) v))) (let ((v field2)) (if t (bindat--pack-uintr bitlen v) > (bindat--pack-uint bitlen v))))))) 42) >   bindat-pack(#s(bindat--type :le (lambda (v) (let ((v v)) (let > ((field2 (if (< v 0) (+ v wrap) v))) (let ((v field2)) (setq bindat-idx > (+ bindat-idx (/ bitlen 8))))))) :ue (lambda nil (let ((n (if t > (bindat--unpack-uintr bitlen) (bindat--unpack-uint bitlen)))) (if (>= n > max) (- n wrap) n))) :pe (lambda (v) (let ((v v)) (let ((field2 (if (< v > 0) (+ v wrap) v))) (let ((v field2)) (if t (bindat--pack-uintr bitlen v) > (bindat--pack-uint bitlen v))))))) 42) >   load-with-code-conversion("/tmp/bd.el" "/tmp/bd.el" nil t) >   command-line-1(("-l" "/tmp/bd.el")) >   command-line() >   normal-top-level() > Symbol’s value as variable is void: bitlen > > This bug is difficult to understand. Run from an IELM buffer, this code > works as expected. The macroexpansion of the bindat-type declaration > includes a binding for bitlen. Thanks, I added Stefan to this discussion. From unknown Sun Sep 07 01:28:04 2025 X-Loop: help-debbugs@gnu.org Subject: bug#69749: (bindat-type sint 32 t) -> unbound variable bitlen Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 13 Mar 2024 12:56:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69749 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Eli Zaretskii Cc: 69749@debbugs.gnu.org, Eric Marsden Received: via spool by 69749-submit@debbugs.gnu.org id=B69749.171033455132214 (code B ref 69749); Wed, 13 Mar 2024 12:56:02 +0000 Received: (at 69749) by debbugs.gnu.org; 13 Mar 2024 12:55:51 +0000 Received: from localhost ([127.0.0.1]:45006 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rkO99-0008NW-BH for submit@debbugs.gnu.org; Wed, 13 Mar 2024 08:55:51 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:1752) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rkO8u-0008Ms-SW for 69749@debbugs.gnu.org; Wed, 13 Mar 2024 08:55:50 -0400 Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 15BBD100249; Wed, 13 Mar 2024 08:54:56 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1710334495; bh=0GLwSaskR3AupIR/7yQX3fQiQ+bGOJaeg7yQ8Bhg9SA=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=fFxe6sMO4GUSS5f/6d93nnSyVOtYa51Qy9DsxL8etW6ub5QqpbKI7+WZZJtvBpsD1 Y7TyktsfRgvrWdAgzWrzc/utxZQR51GaxwEK1QgQ/wu2yXtCYrJGG911XxNZgKf8si azYvS5x/plz8IxXE8HarMCX6F+uHLEM49u1u+NbEg4APIEUoHxFgAoxLU/9SNSe5+h bnyarUWtlRujT/a5+0kIqVjPnFMCi/5HzDHWkDKVEfb7ir/OkyqH0SGnDmZy0KNH8R 5/isWXAlanp2mdhpb+793qgaSktbUUN21xGdME27UrzcPU0BOPFdhMxEHjdxVmyNaF zKZVQMM8u/JAA== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 332FB1000DD; Wed, 13 Mar 2024 08:54:55 -0400 (EDT) Received: from pastel (unknown [216.154.27.181]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 0D7911206A7; Wed, 13 Mar 2024 08:54:55 -0400 (EDT) From: Stefan Monnier In-Reply-To: <86cyrytkk7.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 13 Mar 2024 13:53:12 +0200") Message-ID: References: <82a56165-7684-4f10-a6c4-60ff27de0417@risk-engineering.org> <86cyrytkk7.fsf@gnu.org> Date: Wed, 13 Mar 2024 08:54:53 -0400 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL 0.075 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain T_SCC_BODY_TEXT_LINE -0.01 - X-SPAM-LEVEL: 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: -3.3 (---) >> -- file bd.el >> (require 'bindat) >> (bindat-pack (bindat-type sint 32 t) 42) >> --=20 When you open this file in Emacs=E2=89=A528, the modeline will have an oran= ge "/d" which is meant to warn you that something's amiss. Click on it, and your problem will be solved :-) >> Symbol=E2=80=99s value as variable is void: bitlen >> >> This bug is difficult to understand. Run from an IELM buffer, this code= =20 >> works as expected. The macroexpansion of the bindat-type declaration=20 >> includes a binding for bitlen. Your code ends up (via the `sint` of `bindat-type`) relying on the `lexical-binding` dialect of ELisp, which is enabled by default in `ielm` but not in your file. Stefan From unknown Sun Sep 07 01:28:04 2025 X-Loop: help-debbugs@gnu.org Subject: bug#69749: (bindat-type sint 32 t) -> unbound variable bitlen Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 15 Mar 2024 16:53:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69749 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Eric Marsden Cc: Eli Zaretskii , 69749@debbugs.gnu.org Received: via spool by 69749-submit@debbugs.gnu.org id=B69749.17105215465003 (code B ref 69749); Fri, 15 Mar 2024 16:53:01 +0000 Received: (at 69749) by debbugs.gnu.org; 15 Mar 2024 16:52:26 +0000 Received: from localhost ([127.0.0.1]:53647 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rlAnB-0001Ib-OA for submit@debbugs.gnu.org; Fri, 15 Mar 2024 12:52:26 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:33067) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rlAn7-0001IL-D0 for 69749@debbugs.gnu.org; Fri, 15 Mar 2024 12:52:23 -0400 Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id C3696100170; Fri, 15 Mar 2024 12:51:38 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1710521497; bh=VTfjkxl+MKjEkJWhJq2u8POXJqgnQuNjoA68wtkvOr8=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=bhZ15fEWIthJlp91QeLc5IL6qU1eHxGGRbVku24pzqdT9a2zGdKn3lR4N5nmA5EeB Z/0K5KI8pyZups8c5m2LJ4lIqDlqviQJUe0EIHyruLj0YgVKIDuY3VX8WtueI1g1F9 gw70zxe1LsJz5kseVkh3EgQu4qWIynat0jKYEn1BTXNOHGzNkFWM6y6z0AlmdV9mIG SWHkWCIflehM4jR/ddefsl4NFtBPa46KS2h2y4DAXGLb1roUQLzKrqxdKhIrfMB4zC uEl26h27bYpHcS2gB659kJjebAyc+aHhEWBkEBdBQhTHnfD/MIRjzY3Wxc9Bn02AJw mwy0LhWrjXQeQ== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id CC7F910005D; Fri, 15 Mar 2024 12:51:37 -0400 (EDT) Received: from alfajor (unknown [23.233.149.155]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id AD5751207CD; Fri, 15 Mar 2024 12:51:37 -0400 (EDT) From: Stefan Monnier In-Reply-To: <4a7ccaf7-02dc-4cca-b6e7-520ffb45dcac@risk-engineering.org> (Eric Marsden's message of "Fri, 15 Mar 2024 08:39:11 +0100") Message-ID: References: <82a56165-7684-4f10-a6c4-60ff27de0417@risk-engineering.org> <86cyrytkk7.fsf@gnu.org> <4a7ccaf7-02dc-4cca-b6e7-520ffb45dcac@risk-engineering.org> Date: Fri, 15 Mar 2024 12:51:36 -0400 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -0.238 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain T_SCC_BODY_TEXT_LINE -0.01 - X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) 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: -3.3 (---) >> Your code ends up (via the `sint` of `bindat-type`) relying on the >> `lexical-binding` dialect of ELisp, which is enabled by default in >> `ielm` but not in your file. > Indeed, thanks for the fix. > Perhaps it would be useful for the bindat-type macro to emit a warning wh= en > it is running in the dynamic-binding dialect (at least for the types that > require lexical binding)? Agreed. I just pushed a corresponding patch to `master`. It impacts only `sint` (among the predefined types). > This would have no runtime cost when byte-compiled or native-compiled, > I assume. The patch I installed indeed doesn't impact the performance of the code. The underlying detail which requires `lexical-binding` to be active does cause the code for `sint` to be significantly less efficient than that for `uint`, tho, so if performance is important, you may prefer to use `uint` and do the conversion to a signed integer manually elsewhere. =F0=9F= =99=81 Stefan From unknown Sun Sep 07 01:28:04 2025 X-Loop: help-debbugs@gnu.org Subject: bug#69749: (bindat-type sint 32 t) -> unbound variable bitlen Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 16 Mar 2024 11:18:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69749 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Stefan Monnier Cc: 69749@debbugs.gnu.org, eric.marsden@risk-engineering.org Received: via spool by 69749-submit@debbugs.gnu.org id=B69749.17105878277492 (code B ref 69749); Sat, 16 Mar 2024 11:18:01 +0000 Received: (at 69749) by debbugs.gnu.org; 16 Mar 2024 11:17:07 +0000 Received: from localhost ([127.0.0.1]:55007 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rlS2F-0001wl-1V for submit@debbugs.gnu.org; Sat, 16 Mar 2024 07:17:07 -0400 Received: from eggs.gnu.org ([209.51.188.92]:55794) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rlS2D-0001w7-AG for 69749@debbugs.gnu.org; Sat, 16 Mar 2024 07:17:05 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rlS1W-0001VM-Ha; Sat, 16 Mar 2024 07:16:22 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=yDM/zjq0YMMu7m2VyHGsYZX50ue0hHuHyg3ENAH9njk=; b=hCn3jauDQB6XZq8e/Zsn EV1G9cBR2MIrD9GKZbaOXBn/PAY0eBcE6zmiCXPgP9wfftkUN2GYG4/2qosyHYezAh25L2owqXAM2 TNbXqqkfPT+kngLK0RtoCkrygkO5kRfbxxJO7t+70DB0JJpO+9odaDOXe4ygPFcQgM25ao16k4zj9 C5cMN7GUaIaAbwretclfhnlHRqpNT3kmffkvqsQ9g8Z6exCtB4bazyuzdINe1U9QBY8IPHoC2waLK JxY5XGYUH3A7B6qdqHy+xqy32IJHTgKyOUz/hsdQlaZLL5HVSOu64pilbTm8ksVCj9jvXsYjlwl52 o+v5E+DKL1G/sA==; Date: Sat, 16 Mar 2024 13:16:17 +0200 Message-Id: <861q8a77ge.fsf@gnu.org> From: Eli Zaretskii In-Reply-To: (message from Stefan Monnier on Fri, 15 Mar 2024 12:51:36 -0400) References: <82a56165-7684-4f10-a6c4-60ff27de0417@risk-engineering.org> <86cyrytkk7.fsf@gnu.org> <4a7ccaf7-02dc-4cca-b6e7-520ffb45dcac@risk-engineering.org> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) 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: -3.3 (---) > From: Stefan Monnier > Cc: Eli Zaretskii , 69749@debbugs.gnu.org > Date: Fri, 15 Mar 2024 12:51:36 -0400 > > >> Your code ends up (via the `sint` of `bindat-type`) relying on the > >> `lexical-binding` dialect of ELisp, which is enabled by default in > >> `ielm` but not in your file. > > Indeed, thanks for the fix. > > Perhaps it would be useful for the bindat-type macro to emit a warning when > > it is running in the dynamic-binding dialect (at least for the types that > > require lexical binding)? > > Agreed. I just pushed a corresponding patch to `master`. > It impacts only `sint` (among the predefined types). > > > This would have no runtime cost when byte-compiled or native-compiled, > > I assume. > > The patch I installed indeed doesn't impact the performance of the code. > The underlying detail which requires `lexical-binding` to be active does > cause the code for `sint` to be significantly less efficient than that > for `uint`, tho, so if performance is important, you may prefer to use > `uint` and do the conversion to a signed integer manually elsewhere. 🙁 Thanks, should we now close this bug? From unknown Sun Sep 07 01:28:04 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: Eric Marsden Subject: bug#69749: closed (Re: bug#69749: (bindat-type sint 32 t) -> unbound variable bitlen) Message-ID: References: <86wmq04qpl.fsf@gnu.org> <82a56165-7684-4f10-a6c4-60ff27de0417@risk-engineering.org> X-Gnu-PR-Message: they-closed 69749 X-Gnu-PR-Package: emacs Reply-To: 69749@debbugs.gnu.org Date: Sun, 17 Mar 2024 19:14:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1710702842-10813-1" This is a multi-part message in MIME format... ------------=_1710702842-10813-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #69749: (bindat-type sint 32 t) -> unbound variable bitlen which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 69749@debbugs.gnu.org. --=20 69749: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D69749 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1710702842-10813-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 69749-done) by debbugs.gnu.org; 17 Mar 2024 19:14:01 +0000 Received: from localhost ([127.0.0.1]:36495 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rlvxI-0002o4-SC for submit@debbugs.gnu.org; Sun, 17 Mar 2024 15:14:01 -0400 Received: from eggs.gnu.org ([209.51.188.92]:45430) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rlvxH-0002nc-21 for 69749-done@debbugs.gnu.org; Sun, 17 Mar 2024 15:13:59 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rlvwX-0003gQ-So; Sun, 17 Mar 2024 15:13:13 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=N3RfDX9jnBGul15Hs0piJio8rr6nn6OFOgOqgquaXVI=; b=EZQlCvP25GGlMxpkIWlT f9tshOw9b5OaqerRRiKgF7hAAm92Nd/E14vmcVoDnjTlvVDJYp0+r7O2DRHsro0AZal1qFkKqoh83 4qsSvzkbk2/gxBaUUYwfM7SbML/Wn/kOxGBwkuDqmFnFz1YFPrJ8ORW5wJg04QZsjrEmhObVlZ669 MWYH1JYLBs/1mfmu6NycZdQNd2zaV4lZTf41UQBoWVDdf86ytl4DHDmcM0Y0Otg0Y8a4ByGZj8yC7 sbIrZMnxtGGkhIwI3eSZBQcV57UlLw6xtC8d1ekVmUkswrFQOOtExFQNP1C0Im9GE4xKHzxThfX0J 7rtVX8zCY8Cbvw==; Date: Sun, 17 Mar 2024 21:13:10 +0200 Message-Id: <86wmq04qpl.fsf@gnu.org> From: Eli Zaretskii To: Eric Marsden In-Reply-To: <000d8acf-bad4-432a-a775-0c03225674fe@risk-engineering.org> (message from Eric Marsden on Sun, 17 Mar 2024 19:28:17 +0100) Subject: Re: bug#69749: (bindat-type sint 32 t) -> unbound variable bitlen References: <82a56165-7684-4f10-a6c4-60ff27de0417@risk-engineering.org> <86cyrytkk7.fsf@gnu.org> <4a7ccaf7-02dc-4cca-b6e7-520ffb45dcac@risk-engineering.org> <861q8a77ge.fsf@gnu.org> <000d8acf-bad4-432a-a775-0c03225674fe@risk-engineering.org> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 69749-done Cc: 69749-done@debbugs.gnu.org, monnier@iro.umontreal.ca 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: -3.3 (---) > Date: Sun, 17 Mar 2024 19:28:17 +0100 > Cc: 69749-done@debbugs.gnu.org > From: Eric Marsden > > Le 3/16/2024 à 12:16 PM, Eli Zaretskii a écrit : > >> The patch I installed indeed doesn't impact the performance of the code. > >> The underlying detail which requires `lexical-binding` to be active does > >> cause the code for `sint` to be significantly less efficient than that > >> for `uint`, tho, so if performance is important, you may prefer to use > >> `uint` and do the conversion to a signed integer manually elsewhere. 🙁 > > Thanks, should we now close this bug? > > In my opinion yes, and thanks. > > (Not sure whether my cc to -done will work.) It will. ------------=_1710702842-10813-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 12 Mar 2024 15:19:42 +0000 Received: from localhost ([127.0.0.1]:43403 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rk3un-0003nX-HL for submit@debbugs.gnu.org; Tue, 12 Mar 2024 11:19:41 -0400 Received: from lists.gnu.org ([209.51.188.17]:33320) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rk3um-0003nP-7M for submit@debbugs.gnu.org; Tue, 12 Mar 2024 11:19:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rk3uD-0000MO-8R for bug-gnu-emacs@gnu.org; Tue, 12 Mar 2024 11:19:05 -0400 Received: from mail.risk-engineering.org ([2a01:4f8:c0c:a3f8::1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rk3uB-0006Uo-86 for bug-gnu-emacs@gnu.org; Tue, 12 Mar 2024 11:19:05 -0400 DKIM-Signature: a=rsa-sha256; bh=njRrrlc3YOe9ZVWjrEgGRHIv4QpyPlCPoNuJgixqwRU=; c=relaxed/relaxed; d=risk-engineering.org; h=Subject:Subject:Sender:To:To:Cc:From:From:Date:Date:MIME-Version:MIME-Version:Content-Type:Content-Type:Content-Transfer-Encoding:Content-Transfer-Encoding:Reply-To:In-Reply-To:Message-Id:Message-Id:References:Autocrypt:Openpgp; i=@risk-engineering.org; s=default; t=1710256738; v=1; x=1710688738; b=Ba92V4W2ukMTm8r0CkQUkeFpbGf6m8qNBIsCeWjR8H0Xfm0JnxS/8iGIDFHSkqw/SINl3Fem veFyZWqA4kMDZuMi3xRFBVPnIdks4W8J28YrVqSz56/BE3ojeE12k5xLW2PbqMu3MIiiyG/sUUu R4g2+xVfChcPEGKGdM8qlK5ziJGKyIo91z2jGJFENAdrlnLuUB2Hscay91kxlhzLMEtOs02KExn DDlL2QUUB65Fdqwuw/khPr4omGOLEIa3AKTDGtE39KU+GThMIeeS2wyrUPQdZCg+BToyDexES5Z Zff26mRzpdBoxE2EFqehcwhCkVN43FO01nDN1bNDjUxjA== Received: by mail.risk-engineering.org (envelope-sender ) with ESMTPS id 48ff29fc; Tue, 12 Mar 2024 16:18:58 +0100 Message-ID: <82a56165-7684-4f10-a6c4-60ff27de0417@risk-engineering.org> Date: Tue, 12 Mar 2024 16:18:58 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US To: bug-gnu-emacs@gnu.org From: Eric Marsden Subject: (bindat-type sint 32 t) -> unbound variable bitlen Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2a01:4f8:c0c:a3f8::1; envelope-from=eric.marsden@risk-engineering.org; helo=mail.risk-engineering.org X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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 (--) -- file bd.el (require 'bindat) (bindat-pack (bindat-type sint 32 t) 42) -- emacs -Q --batch -l bd.el --> Error: void-variable (bitlen)   mapbacktrace(#f(compiled-function (evald func args flags) #))   debug-early-backtrace()   debug-early(error (void-variable bitlen))   (/ bitlen 8)   (+ bindat-idx (/ bitlen 8))   (setq bindat-idx (+ bindat-idx (/ bitlen 8)))   (let ((v field2)) (setq bindat-idx (+ bindat-idx (/ bitlen 8))))   (let ((field2 (if (< v 0) (+ v wrap) v))) (let ((v field2)) (setq bindat-idx (+ bindat-idx (/ bitlen 8)))))   (let ((v v)) (let ((field2 (if (< v 0) (+ v wrap) v))) (let ((v field2)) (setq bindat-idx (+ bindat-idx (/ bitlen 8))))))   (lambda (v) (let ((v v)) (let ((field2 (if (< v 0) (+ v wrap) v))) (let ((v field2)) (setq bindat-idx (+ bindat-idx (/ bitlen 8)))))))(42)   bindat--length-group(42 #s(bindat--type :le (lambda (v) (let ((v v)) (let ((field2 (if (< v 0) (+ v wrap) v))) (let ((v field2)) (setq bindat-idx (+ bindat-idx (/ bitlen 8))))))) :ue (lambda nil (let ((n (if t (bindat--unpack-uintr bitlen) (bindat--unpack-uint bitlen)))) (if (>= n max) (- n wrap) n))) :pe (lambda (v) (let ((v v)) (let ((field2 (if (< v 0) (+ v wrap) v))) (let ((v field2)) (if t (bindat--pack-uintr bitlen v) (bindat--pack-uint bitlen v))))))))   bindat-length(#s(bindat--type :le (lambda (v) (let ((v v)) (let ((field2 (if (< v 0) (+ v wrap) v))) (let ((v field2)) (setq bindat-idx (+ bindat-idx (/ bitlen 8))))))) :ue (lambda nil (let ((n (if t (bindat--unpack-uintr bitlen) (bindat--unpack-uint bitlen)))) (if (>= n max) (- n wrap) n))) :pe (lambda (v) (let ((v v)) (let ((field2 (if (< v 0) (+ v wrap) v))) (let ((v field2)) (if t (bindat--pack-uintr bitlen v) (bindat--pack-uint bitlen v))))))) 42)   bindat-pack(#s(bindat--type :le (lambda (v) (let ((v v)) (let ((field2 (if (< v 0) (+ v wrap) v))) (let ((v field2)) (setq bindat-idx (+ bindat-idx (/ bitlen 8))))))) :ue (lambda nil (let ((n (if t (bindat--unpack-uintr bitlen) (bindat--unpack-uint bitlen)))) (if (>= n max) (- n wrap) n))) :pe (lambda (v) (let ((v v)) (let ((field2 (if (< v 0) (+ v wrap) v))) (let ((v field2)) (if t (bindat--pack-uintr bitlen v) (bindat--pack-uint bitlen v))))))) 42)   load-with-code-conversion("/tmp/bd.el" "/tmp/bd.el" nil t)   command-line-1(("-l" "/tmp/bd.el"))   command-line()   normal-top-level() Symbol’s value as variable is void: bitlen This bug is difficult to understand. Run from an IELM buffer, this code works as expected. The macroexpansion of the bindat-type declaration includes a binding for bitlen. GNU Emacs 29.2 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.41, cairo version 1.18.0) of 2024-03-09, modified by Debian ------------=_1710702842-10813-1--