Package: emacs;
Reported by: Richard Hansen <rhansen <at> rhansen.org>
Date: Mon, 30 May 2022 06:48:02 UTC
Severity: normal
Tags: patch
Found in version 29.0.50
Done: Richard Hansen <rhansen <at> rhansen.org>
Bug is archived. No further changes may be made.
View this message in rfc822 format
From: Richard Hansen <rhansen <at> rhansen.org> To: 55719 <at> debbugs.gnu.org Subject: bug#55719: 29.0.50; various bindat strz bugs Date: Mon, 30 May 2022 00:11:54 -0400
There are a number of bugs with strz packing and unpacking in the bindat package: (require 'bindat) (require 'ert) (let ((s (bindat-type :pack-var v (x strz :pack-val v) :unpack-val x))) ;; Bug: length doesn't count the null terminator. (ert-deftest t1 () (should (equal (bindat-length s "x") 2))) ;; Bug: pack doesn't include the null terminator. (ert-deftest t2 () (should (equal (bindat-pack s "x") "\170\0"))) ;; Bug: unpack throws (wrong-type-argument number-or-marker-p nil) (ert-deftest t3 () (should (equal (bindat-unpack s "\170\0") "x")))) (let ((s (bindat-type :pack-var v (x strz 2 :pack-val v) :unpack-val x))) ;; Bug: pack doesn't always include the null terminator. (ert-deftest t4 () (should (equal (bindat-pack s "xx") "\170\0")))) (let ((s '((x strz 2)))) ;; Bug: pack doesn't always include the null terminator. (ert-deftest t5 () (should (equal (bindat-pack s '((x . "xx"))) "\170\0")))) In addition to the above issues, legacy-style specs with no strz length, such as '((x strz)), do not work. But I suspect length only became optional when `bindat-type' was introduced, so that's probably not an issue. In GNU Emacs 29.0.50 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.20, cairo version 1.16.0) of 2022-05-29 built on sprinkles Repository revision: 7f7acf395697e4cfa470cfa2993b70c2308e95c1 Repository branch: master Windowing system distributor 'The X.Org Foundation', version 11.0.12013000 System Description: Ubuntu 20.04.4 LTS Configured using: 'configure --build=x86_64-linux-gnu --prefix=/usr '--includedir=${prefix}/include' '--mandir=${prefix}/share/man' '--infodir=${prefix}/share/info' --sysconfdir=/etc --localstatedir=/var --disable-option-checking --disable-silent-rules '--libdir=${prefix}/lib/x86_64-linux-gnu' '--libexecdir=${prefix}/lib/x86_64-linux-gnu' --disable-maintainer-mode --disable-dependency-tracking --prefix=/usr --sharedstatedir=/var/lib --with-modules=yes --with-x=yes --with-x-toolkit=gtk3 --with-xwidgets=yes --without-pgtk' Configured features: ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG JSON LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS X11 XDBE XIM XINPUT2 XPM XWIDGETS GTK3 ZLIB Important settings: value of $LC_MONETARY: en_US.UTF-8 value of $LC_NUMERIC: en_US.UTF-8 value of $LC_TIME: root.UTF-8 value of $LANG: en_US.UTF-8 locale-coding-system: utf-8-unix Major mode: Lisp Interaction Minor modes in effect: tooltip-mode: t global-eldoc-mode: t eldoc-mode: t show-paren-mode: t electric-indent-mode: t mouse-wheel-mode: t tool-bar-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t line-number-mode: t indent-tabs-mode: t transient-mark-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t Load-path shadows: None found. Features: (shadow sort mail-extr emacsbug message mailcap yank-media rmc puny dired dired-loaddefs rfc822 mml mml-sec epa derived epg rfc6068 epg-config gnus-util text-property-search mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils ffap thingatpt url-parse auth-source eieio eieio-core eieio-loaddefs password-cache json url-vars help-fns radix-tree cl-print cl-extra ert map seq pp ewoc debug backtrace help-mode find-func bindat byte-opt bytecomp byte-compile cconv pcase cl-seq cl-macs gv time-date subr-x cl-loaddefs cl-lib iso-transl tooltip eldoc paren electric uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel term/x-win x-win term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe tabulated-list replace newcomment text-mode lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch easymenu timer select scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors frame minibuffer nadvice simple cl-generic indonesian philippine cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese composite emoji-zwj charscript charprop case-table epa-hook jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button loaddefs faces cus-face macroexp files window text-properties overlay sha1 md5 base64 format env code-pages mule custom widget keymap hashtable-print-readable backquote threads xwidget-internal dbusbind inotify lcms2 dynamic-setting system-font-setting font-render-setting cairo move-toolbar gtk x-toolkit xinput2 x multi-tty make-network-process emacs) Memory information: ((conses 16 74917 10902) (symbols 48 8201 0) (strings 32 23138 2251) (string-bytes 1 732663) (vectors 16 16128) (vector-slots 8 211715 13201) (floats 8 98 309) (intervals 56 475 0) (buffers 992 14))
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.