From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#70187: [PATCH] Fix + ert for 'makunbound' and "local if set" notification bugs (6 of 9) Date: Sat, 06 Apr 2024 10:38:46 +0300 Message-ID: <86le5r3pq1.fsf@gnu.org> References: Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="15971"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 70187@debbugs.gnu.org To: Robert Burks , Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Apr 06 09:40:17 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rt0eu-0003uj-D6 for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 06 Apr 2024 09:40:16 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rt0eb-00067w-KR; Sat, 06 Apr 2024 03:39:57 -0400 Original-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 1rt0ea-00067f-BS for bug-gnu-emacs@gnu.org; Sat, 06 Apr 2024 03:39:56 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rt0eZ-0002Ip-U0 for bug-gnu-emacs@gnu.org; Sat, 06 Apr 2024 03:39:55 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rt0ef-00069Z-Ti for bug-gnu-emacs@gnu.org; Sat, 06 Apr 2024 03:40:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 06 Apr 2024 07:40:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 70187 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 70187-submit@debbugs.gnu.org id=B70187.171238914323405 (code B ref 70187); Sat, 06 Apr 2024 07:40:01 +0000 Original-Received: (at 70187) by debbugs.gnu.org; 6 Apr 2024 07:39:03 +0000 Original-Received: from localhost ([127.0.0.1]:38098 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rt0dj-00065R-9F for submit@debbugs.gnu.org; Sat, 06 Apr 2024 03:39:03 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:53564) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rt0dg-00064J-6F for 70187@debbugs.gnu.org; Sat, 06 Apr 2024 03:39:01 -0400 Original-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 1rt0dU-0002E1-RX; Sat, 06 Apr 2024 03:38:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=cB50TnUoF6fn7nDvrGdeTERvNK8m1OkGOItGj/AaM1w=; b=aQwt5vp/tvYI 17kg0IUYNOUirAv9MWC/CAGPanFOkURsJPolFqlUCquiSzhbWRiTz0m/jgLhCxZTe4m2Fahvjuhr6 q//eweLVRILCmkZovedUsaW8cFV64Yl6N94uKSsP7iggfktfD9SqJyCnQoKDOJUjOj5qOYNli6T5y XUDRexZxTHFZYREqDJnpiMdwstUk1xlqgPZUqxjKE/+b/PVimK6gg0XxSBmvjuX1NTuPcV/bVjZkB a1X9+hSiabSdFMBK6XkDc8jjt3WSLjDxh4JLm8hr74WMxD96dFvk8vDNj7sCmoY0eARb/P5c9fB1r e6omXDUOIYhin6H0qQrOPw==; In-Reply-To: (message from Robert Burks on Thu, 4 Apr 2024 04:46:26 -0400) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:282752 Archived-At: > From: Robert Burks > Date: Thu, 4 Apr 2024 04:46:26 -0400 > > (6 of 9) > > Bug#00005 (Buffer local makunbounds lack 'where' in notification) > ** Bug recreations are at the end > > It wasn't until the last line of the test for the previous bug until I realized > these existed. I have included a patch to fix this bug and the prior along with > ert. I have also included a patch that corrects an incorrect testing assumption. > This is the only existing should form that I have found that was in error. > (This subject widely lacked testing previously.) > > When a "local if set" variable or variable made local to a specific buffer is > unbound in a buffer the notification should contain the location. > > This bug could only be solved after the others as prior to my changes > notification was handled in aggregate at the top of set functions. Handling these > bugs was dependent on notification being handled based on the redirect path. This > could actually be applied after "bug#00001", I just worked on this last (It took > a bit of gdb tracing to root out) and I didn't want to go back through and > renumber all my writing. (During proofreading way later I laughed because there > ended up being far more after this.) > > I have also included ert for previously untested error cases in set_internal, > set_default_internal, and defvaralias. > > Patch 0016: Fix for bugs 00004 and 00005 (four(4) places require bug# update) > > Patch 0017: Ert for bug#00004 (four(4) places require bug# update) > > Patch 0018: Corrected one 'should' form to include buffer name > > Patch 0019: Ert for bug#00005 (four(4) places require bug# update) > > Patch 0020: Added ert for functions that lacked testing code coverage for > basic input errors. > > Bug Recreation------------------------------------------------------------------ > > Watched variable becoming local in some buffer then being unbound. > --------------------------------------------------------------------------------------- > (defvar test 5) > test > > (defvar results nil) > results > > (add-variable-watcher 'test (lambda (&rest args) > (push args results))) > nil > > (with-temp-buffer > (make-local-variable 'test) > (set 'test 100) > (makunbound 'test)) > test > 5 > > (set 'test 100) > 100 > > results > ((test 100 set nil) (test nil makunbound nil) (test 100 set #)) > ;; test is still bound in this buffer but 'where' is 'nil', it was unbound in the temp buffer. > ;; The final set shows nil as it should for a global. > > (set 'results nil) > nil > > (with-temp-buffer > (make-local-variable 'test) > (set 'test 100) > (makunbound 'test) > (set 'test 200)) > 200 > > test > 100 > > (set 'test 300) > > results > ((test 300 set nil) (test 200 set #) (test nil makunbound nil) (test 100 set #)) > ;; a watcher needs to know where this makunbound happened. > > --------------------------------------------------------------------------------------- > A "local if set" become unbound in some buffer, > --------------------------------------------------------------------------------------- > (defvar-local test 5) > test > > (defvar results nil) > results > > (add-variable-watcher 'test (lambda (&rest args) > (push args results))) > nil > > (with-temp-buffer > (set 'test 100) > (makunbound 'test)) > test > > (set 'test 100) > 100 > > results > ((test 100 set #) (test nil makunbound nil) (test 100 set #)) > > (set 'results nil) > nil > > (with-temp-buffer > (set 'test 100) > (makunbound 'test) > (set 'test 200)) > 200 > > test > 100 > > (set 'test 300) > 300 > > results > ((test 300 set #) (test 200 set #) (test nil makunbound nil) (test 100 set > #)) Stefan, any comments on the issues and the patches? Note that the patches were updated later in bug#70189. Thanks.