GNU bug report logs - #57362
[PATCH] Fix string padding in gdb-mi

Previous Next

Package: emacs;

Reported by: Santiago Calandrino <san <at> disroot.org>

Date: Tue, 23 Aug 2022 17:30:03 UTC

Severity: normal

Tags: patch

Fixed in version 29.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 57362 in the body.
You can then email your comments to 57362 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#57362; Package emacs. (Tue, 23 Aug 2022 17:30:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Santiago Calandrino <san <at> disroot.org>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 23 Aug 2022 17:30:03 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Santiago Calandrino <san <at> disroot.org>
To: bug-gnu-emacs <at> gnu.org
Subject: [PATCH] Fix string padding in gdb-mi
Date: Tue, 23 Aug 2022 12:26:22 -0300
[Message part 1 (text/plain, inline)]
Hello, I recently updated my Emacs following the master branch and
encountered a bug in gdb introduced in commit f6356dc88d23 which breaks
some of its buffers. I've attempted to fix it with this patch. Let me
know if I made any mistakes since it is my first contribution.


[0001-Fix-string-padding-in-gdb-mi.patch (text/x-patch, inline)]
From 7c80780f4ca0bad2af3d137f4ee919eb0d3e9019 Mon Sep 17 00:00:00 2001
From: Santiago Calandrino <san <at> disroot.org>
Date: Mon, 22 Aug 2022 12:01:44 -0300
Subject: [PATCH] Fix string padding in gdb-mi

In commit f6356dc88d23eb405aa6d8bd9dd5f669f1bc45ee local padding
function gdp-pad-string was replaced with string-pad from subr-x. The
problem is that calls to string-pad use negative integers which result
in errors that prevent text to be displayed on gdb information
buffers. Now padding is stored as positive integers and calls to
string-pad check if they should be right aligned.

* lisp/progmodes/gdb-mi.el (gdb-table): Fix string padding in gdb-mi.

Copyright-paperwork-exempt: yes
---
 lisp/progmodes/gdb-mi.el | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/lisp/progmodes/gdb-mi.el b/lisp/progmodes/gdb-mi.el
index c256198b3c..f2b4aa1054 100644
--- a/lisp/progmodes/gdb-mi.el
+++ b/lisp/progmodes/gdb-mi.el
@@ -2944,7 +2944,7 @@ gdb-mark-line
 
 (defun gdb-pad-string (string padding)
   (declare (obsolete string-pad "29.1"))
-  (string-pad string padding nil t))
+  (string-pad string (abs padding) nil (natnump padding)))
 
 ;; gdb-table struct is a way to programmatically construct simple
 ;; tables. It help to reliably align columns of data in GDB buffers
@@ -2962,8 +2962,7 @@ gdb-table-add-row
 calling `gdb-table-string'."
   (let ((rows (gdb-table-rows table))
         (row-properties (gdb-table-row-properties table))
-        (column-sizes (gdb-table-column-sizes table))
-        (right-align (gdb-table-right-align table)))
+        (column-sizes (gdb-table-column-sizes table)))
     (when (not column-sizes)
       (setf (gdb-table-column-sizes table)
             (make-list (length row) 0)))
@@ -2973,9 +2972,7 @@ gdb-table-add-row
           (append row-properties (list properties)))
     (setf (gdb-table-column-sizes table)
           (cl-mapcar (lambda (x s)
-                         (let ((new-x
-                                (max (abs x) (string-width (or s "")))))
-                           (if right-align new-x (- new-x))))
+                       (max (abs x) (string-width (or s ""))))
                        (gdb-table-column-sizes table)
                        row))
     ;; Avoid trailing whitespace at eol
@@ -2991,7 +2988,10 @@ gdb-table-string
       (lambda (row properties)
         (apply #'propertize
                (mapconcat #'identity
-                          (cl-mapcar (lambda (s x) (string-pad s x nil t))
+                          (cl-mapcar (lambda (s x)
+                                       (string-pad
+                                        s x nil
+                                        (not (gdb-table-right-align table))))
                                      row column-sizes)
                           sep)
                properties))
-- 
2.37.1


Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#57362; Package emacs. (Wed, 24 Aug 2022 11:56:01 GMT) Full text and rfc822 format available.

Message #8 received at 57362 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Santiago Calandrino <san <at> disroot.org>
Cc: 57362 <at> debbugs.gnu.org
Subject: Re: bug#57362: [PATCH] Fix string padding in gdb-mi
Date: Wed, 24 Aug 2022 13:55:09 +0200
Santiago Calandrino <san <at> disroot.org> writes:

> Hello, I recently updated my Emacs following the master branch and
> encountered a bug in gdb introduced in commit f6356dc88d23 which breaks
> some of its buffers. I've attempted to fix it with this patch. Let me
> know if I made any mistakes since it is my first contribution.

Thanks; looks good to me, so I've pushed it to Emacs 29.

This change was small enough to apply without assigning copyright to the
FSF, but for future patches you want to submit, it might make sense to
get the paperwork started now, so that subsequent patches can be applied
speedily. Would you be willing to sign such paperwork?




bug marked as fixed in version 29.1, send any further explanations to 57362 <at> debbugs.gnu.org and Santiago Calandrino <san <at> disroot.org> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Wed, 24 Aug 2022 11:56:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 22 Sep 2022 11:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 329 days ago.

Previous Next


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