From unknown Mon Aug 18 14:16:41 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#38892 <38892@debbugs.gnu.org> To: bug#38892 <38892@debbugs.gnu.org> Subject: Status: 28.0.50: Hash table printing oddities Reply-To: bug#38892 <38892@debbugs.gnu.org> Date: Mon, 18 Aug 2025 21:16:41 +0000 retitle 38892 28.0.50: Hash table printing oddities reassign 38892 emacs submitter 38892 Pip Cet severity 38892 normal tag 38892 fixed thanks From debbugs-submit-bounces@debbugs.gnu.org Fri Jan 03 07:14:13 2020 Received: (at submit) by debbugs.gnu.org; 3 Jan 2020 12:14:13 +0000 Received: from localhost ([127.0.0.1]:40463 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1inLqH-0006k6-9y for submit@debbugs.gnu.org; Fri, 03 Jan 2020 07:14:13 -0500 Received: from lists.gnu.org ([209.51.188.17]:58715) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1inLqD-0006jw-TV for submit@debbugs.gnu.org; Fri, 03 Jan 2020 07:14:10 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53671) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1inLqC-00032Z-KN for bug-gnu-emacs@gnu.org; Fri, 03 Jan 2020 07:14:09 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM autolearn=disabled version=3.3.2 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1inLqB-0006lx-CM for bug-gnu-emacs@gnu.org; Fri, 03 Jan 2020 07:14:08 -0500 Received: from mail-oi1-x22a.google.com ([2607:f8b0:4864:20::22a]:39642) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1inLqA-0006im-63 for bug-gnu-emacs@gnu.org; Fri, 03 Jan 2020 07:14:06 -0500 Received: by mail-oi1-x22a.google.com with SMTP id a67so14139509oib.6 for ; Fri, 03 Jan 2020 04:14:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=3z6orXkX38Tx+IQRv1x6dLDRmwyqL/WLldWOPLkfeec=; b=JnvUrRqXbTh4q9Q4tDFyVI0AsFLHa+AL6/niIFIWHOPn4vTIdil9mjolz1eHdbEZCn HyT1aoUIwGZOMbEDfIUsP5aY2bVkeSC0V/N2zr3qR6pgEo30xZCsC0EhB8Bg0SuFIUB8 JkeXtZwDi63FspGytMYMrzEZuO3cCJ61H1fzGYksRf/nonUlHDAyqiu1y+uUUzPd6AgL 63eyQeTrgdEOtOacil9XRcHV3EBo9yZTvlgV1H5eDUfeZXt8ieCzsuOkGW+t5sePLjHD Ttl2vBbt+1PbgeK9kx7sgoTCCdu4FU2kub6y4W5SdVN8DQCX9Qcs1i6sqLxs95aRONzX MMFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=3z6orXkX38Tx+IQRv1x6dLDRmwyqL/WLldWOPLkfeec=; b=hwZ8QKsB0a/OsGM9IzsnhnPrMDd8FTa4VoUTzmKhcrmnBfbFClAd4Ip4+hq0lHmqA7 j3Kwx9L7nLxLEo2VLypagk+HpO7Rjf02j1lriV26DhRDBLlDB17ia0SrUPGQbB+3aelN AvpcawWYZxbkmujoz9PYInfwlOM18Fg5YHURbBKXDIrEZNMa9dGLaKTXO9SVNn9XReko CFtm+Vz1NQhbP3NF0F9xSLmwpLWQQ1F4YAMIC/iV4YGRJPnWxXj4vi+d++4M3qSM1rYR /jl4AdP74BAv7nQCFysJGBsJ0CGTiOCeqGBo5P4LViWTRArmyQL4T8m9fWBiaJyV/7NP R4gg== X-Gm-Message-State: APjAAAXWgCopGjpqmBRDJEcGAk6HM25qlk65NMDSMHpnJezydvjCr7xj Zj3TebELQJDsxMM2uiOnmPV1dJK6KReqdvY88LgDSWAq X-Google-Smtp-Source: APXvYqzAOxsdiWarigJxTK8jcH0OMJq0EAIn/UnO+sGASNVmEGm0Jc+eixaamw/nVLEWHFMfHPxwJ/6qjiw/znbJtjQ= X-Received: by 2002:a05:6808:208:: with SMTP id l8mr3660775oie.112.1578053644642; Fri, 03 Jan 2020 04:14:04 -0800 (PST) MIME-Version: 1.0 From: Pip Cet Date: Fri, 3 Jan 2020 12:13:28 +0000 Message-ID: Subject: 28.0.50: Hash table printing oddities To: bug-gnu-emacs@gnu.org Content-Type: multipart/mixed; boundary="000000000000ed05be059b3b3e8a" X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::22a X-Spam-Score: 0.7 (/) 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.3 (--) --000000000000ed05be059b3b3e8a Content-Type: text/plain; charset="UTF-8" The hash table printing code has some oddities: it will print extra spaces sometimes, won't print as many elements as requested under all circumstances, and behave oddly for empty hash tables when print-length is 0. Currently, this code will result in extra spaces in the hash table output: (let ((h (make-hash-table))) (puthash 1 2 h) (puthash 2 3 h) (remhash 1 h) (format "%S" h)) (let ((h (make-hash-table))) (let ((print-length 0)) (format "%S" h))) In the latter case, the output actually includes "data ( ...)", though "data ()" would be shorter and more accurate. Also, the current code contains an oddity that would make it print fewer than print-length hash cells in the data list: (let ((h (make-hash-table))) (dotimes (i 100) (puthash i i h)) (dotimes (i 99) (remhash i h)) (let ((print-length 1)) (format "%S" h))) will produce "data ( ...)", when it should produce "data (99 99)". Proposed patch attached. --000000000000ed05be059b3b3e8a Content-Type: text/x-patch; charset="US-ASCII"; name="0001-Fix-hash-table-printing.patch" Content-Disposition: attachment; filename="0001-Fix-hash-table-printing.patch" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_k4y4bg790 RnJvbSAyOWZlYjBmYTE5NGZiMWVhOWZlNjUxNDI4YjZmYmUwMWQyMThhYTc1IE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiBQaXAgQ2V0IDxwaXBjZXRAZ21haWwuY29tPgpEYXRlOiBGcmks IDMgSmFuIDIwMjAgMTI6MDA6NDQgKzAwMDAKU3ViamVjdDogW1BBVENIXSBGaXggaGFzaCB0YWJs ZSBwcmludGluZwoKUHJldmlvdXNseSwgdGhlIG91dHB1dCB3b3VsZCBzb21ldGltZXMgY29udGFp biBleHRyYSBzcGFjZXMgb3IgZmV3ZXIKZWxlbWVudHMgdGhhbiB3ZXJlIHJlcXVlc3RlZC4KKiBz cmMvcHJpbnQuYyAocHJpbnRfdmVjdG9ybGlrZSk6IEtlZXAgdHJhY2sgb2YgdGhlIGFjdHVhbCBu dW1iZXIgb2YKZWxlbWVudHMgcHJpbnRlZCByYXRoZXIgdGhhbiBhdHRlbXB0aW5nIHRvIHVzZSBo YXNoIGJ1Y2tldCBpbmRpY2VzLgotLS0KIHNyYy9wcmludC5jIHwgMTcgKysrKysrKysrKysrLS0t LS0KIDEgZmlsZSBjaGFuZ2VkLCAxMiBpbnNlcnRpb25zKCspLCA1IGRlbGV0aW9ucygtKQoKZGlm ZiAtLWdpdCBhL3NyYy9wcmludC5jIGIvc3JjL3ByaW50LmMKaW5kZXggNDI1YjBkYzRlZS4uMTRi NWYxOWQ2ZSAxMDA2NDQKLS0tIGEvc3JjL3ByaW50LmMKKysrIGIvc3JjL3ByaW50LmMKQEAgLTE1 NzgsMjcgKzE1NzgsMzQgQEAgcHJpbnRfdmVjdG9ybGlrZSA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nRfb2JqZWN0IChIQVNIX1ZBTFVFIChoLCBpKSwgcHJpbnRjaGFyZnVuLCBlc2NhcGVmbGFnKTsK KwkJaWYgKGogPT0gc2l6ZSkKKwkJICBicmVhazsKIAkgICAgICB9CiAgICAgICAgICAgfQogCi0J aWYgKHNpemUgPCByZWFsX3NpemUpCi0JICBwcmludF9jX3N0cmluZyAoIiAuLi4iLCBwcmludGNo YXJmdW4pOworCWlmIChqIDwgaC0+Y291bnQpCisJICB7CisJICAgIGlmIChqKQorCSAgICAgIHBy aW50Y2hhciAoJyAnLCBwcmludGNoYXJmdW4pOworCSAgICBwcmludF9jX3N0cmluZyAoIi4uLiIs IHByaW50Y2hhcmZ1bik7CisJICB9CiAKIAlwcmludF9jX3N0cmluZyAoIikpIiwgcHJpbnRjaGFy ZnVuKTsKICAgICAgIH0KLS0gCjIuMjQuMAoK --000000000000ed05be059b3b3e8a-- From debbugs-submit-bounces@debbugs.gnu.org Sat Jan 11 04:42:16 2020 Received: (at 38892) by debbugs.gnu.org; 11 Jan 2020 09:42:16 +0000 Received: from localhost ([127.0.0.1]:55372 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iqDHc-00066l-Bi for submit@debbugs.gnu.org; Sat, 11 Jan 2020 04:42:16 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52873) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iqDHa-00066Y-Ra for 38892@debbugs.gnu.org; Sat, 11 Jan 2020 04:42:15 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]:46455) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1iqDHV-00047Y-K7; Sat, 11 Jan 2020 04:42:09 -0500 Received: from [176.228.60.248] (port=3090 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1iqDHT-0004RL-31; Sat, 11 Jan 2020 04:42:09 -0500 Date: Sat, 11 Jan 2020 11:42:09 +0200 Message-Id: <831rs68h3i.fsf@gnu.org> From: Eli Zaretskii To: Pip Cet In-reply-to: (message from Pip Cet on Fri, 3 Jan 2020 12:13:28 +0000) Subject: Re: bug#38892: 28.0.50: Hash table printing oddities References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 38892 Cc: 38892@debbugs.gnu.org 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: Pip Cet > Date: Fri, 3 Jan 2020 12:13:28 +0000 > > Proposed patch attached. Thanks. Can you add a few tests to make sure this works as expected? From debbugs-submit-bounces@debbugs.gnu.org Sun Sep 20 06:25:15 2020 Received: (at 38892) by debbugs.gnu.org; 20 Sep 2020 10:25:15 +0000 Received: from localhost ([127.0.0.1]:48804 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kJwWw-0006AC-R4 for submit@debbugs.gnu.org; Sun, 20 Sep 2020 06:25:15 -0400 Received: from quimby.gnus.org ([95.216.78.240]:58982) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kJwWu-00065l-0K for 38892@debbugs.gnu.org; Sun, 20 Sep 2020 06:25:13 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=WNkWWnPhIylsV3aFvITg5RLDn3hovgzhBXSv3e8+2gc=; b=pbBADqGUd4/j7N2TX8nGRbgIer /WbILTwXTk1o92v9Ltpx0yVd5juuXH++uZVTVuIEtHy18woejk/u7Vnb/aRKBwFBrgF7VjmgdTT3o uTym+PWiW5t67JMvMhegkEHGx3NAerlzufCbs3pKb+KuR+IvLIE8Wr1tx4NFCsdHQPhE=; Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=xo) by quimby with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kJwWd-0006Dj-Fu; Sun, 20 Sep 2020 12:25:05 +0200 From: Lars Ingebrigtsen To: Eli Zaretskii Subject: Re: bug#38892: 28.0.50: Hash table printing oddities References: <831rs68h3i.fsf@gnu.org> X-Now-Playing: Andrew Poppy's _On Zang Tuum Tumb (3): Under the Son_: "The Passage (parts 1, 2, 3)" Date: Sun, 20 Sep 2020 12:24:54 +0200 In-Reply-To: <831rs68h3i.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 11 Jan 2020 11:42:09 +0200") Message-ID: <878sd4rbih.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Eli Zaretskii writes: >> Proposed patch attached. > > Thanks. Can you add a few tests to make sure this works as expected? I've now applied Pip's patch and added the examples from the bug report as tests. Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 38892 Cc: 38892@debbugs.gnu.org, Pip Cet 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: -1.0 (-) Eli Zaretskii writes: >> Proposed patch attached. > > Thanks. Can you add a few tests to make sure this works as expected? I've now applied Pip's patch and added the examples from the bug report as tests. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From debbugs-submit-bounces@debbugs.gnu.org Sun Sep 20 06:25:41 2020 Received: (at control) by debbugs.gnu.org; 20 Sep 2020 10:25:41 +0000 Received: from localhost ([127.0.0.1]:48807 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kJwX8-0006Ae-4g for submit@debbugs.gnu.org; Sun, 20 Sep 2020 06:25:41 -0400 Received: from quimby.gnus.org ([95.216.78.240]:58998) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kJwX5-0006AP-VN for control@debbugs.gnu.org; Sun, 20 Sep 2020 06:25:25 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Subject:From:To:Message-Id:Date:Sender:Reply-To:Cc: MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=QSZ3Ngogq+2Sn3DsEc7gQg9XtiTPLe6o5v9bZQ+sFZo=; b=O0KALJFHc+qo2tJle0qGnLVlsT OubU+A7CfiHa2uz3k6wh0aGO3hWnmycOeUYSv0tl/uYcG9zyj/ffFKUuavXaIr163iOsLql9uPahr qJtqLtClfhknHavok8KUPlCWNzz2bPf+86eV7IpTLov2B7x+YZv4cB1eCnx0rKmm1JDY=; Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=xo) by quimby with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kJwWy-0006Dy-5m for control@debbugs.gnu.org; Sun, 20 Sep 2020 12:25:18 +0200 Date: Sun, 20 Sep 2020 12:25:14 +0200 Message-Id: <877dsorbhx.fsf@gnus.org> To: control@debbugs.gnu.org From: Lars Ingebrigtsen Subject: control message for bug #38892 X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: tags 38892 fixed close 38892 28.1 quit Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: control 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: -1.0 (-) tags 38892 fixed close 38892 28.1 quit From unknown Mon Aug 18 14:16:41 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sun, 18 Oct 2020 11:24:11 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator