GNU bug report logs - #69749
(bindat-type sint 32 t) -> unbound variable bitlen

Previous Next

Package: emacs;

Reported by: Eric Marsden <eric.marsden <at> risk-engineering.org>

Date: Tue, 12 Mar 2024 15:20:02 UTC

Severity: normal

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: tracker <at> debbugs.gnu.org
Subject: bug#69749: closed ((bindat-type sint 32 t) -> unbound variable
 bitlen)
Date: Sun, 17 Mar 2024 19:14:02 +0000
[Message part 1 (text/plain, inline)]
Your message dated Sun, 17 Mar 2024 21:13:10 +0200
with message-id <86wmq04qpl.fsf <at> gnu.org>
and subject line Re: bug#69749: (bindat-type sint 32 t) -> unbound variable bitlen
has caused the debbugs.gnu.org bug report #69749,
regarding (bindat-type sint 32 t) -> unbound variable bitlen
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)


-- 
69749: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=69749
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Eric Marsden <eric.marsden <at> risk-engineering.org>
To: bug-gnu-emacs <at> gnu.org
Subject: (bindat-type sint 32 t) -> unbound variable bitlen
Date: Tue, 12 Mar 2024 16:18:58 +0100
-- 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) #<bytecode 
-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.


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





[Message part 3 (message/rfc822, inline)]
From: Eli Zaretskii <eliz <at> gnu.org>
To: Eric Marsden <eric.marsden <at> risk-engineering.org>
Cc: 69749-done <at> debbugs.gnu.org, monnier <at> iro.umontreal.ca
Subject: Re: bug#69749: (bindat-type sint 32 t) -> unbound variable bitlen
Date: Sun, 17 Mar 2024 21:13:10 +0200
> Date: Sun, 17 Mar 2024 19:28:17 +0100
> Cc: 69749-done <at> debbugs.gnu.org
> From: Eric Marsden <eric.marsden <at> risk-engineering.org>
> 
> 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.


This bug report was last modified 1 year and 144 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.