From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Noam Postavsky Newsgroups: gmane.emacs.bugs Subject: bug#36556: 26.2; python.el pdbtracking sometimes kills buffers when it shouldn't (plus fix) Date: Wed, 17 Jul 2019 19:51:33 -0400 Message-ID: <877e8gz0ca.fsf@gmail.com> References: <85blxsln3a.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="17785"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2.90 (gnu/linux) Cc: 36556@debbugs.gnu.org To: Ken Manheimer Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Jul 18 01:52:08 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hntiS-0004SG-H4 for geb-bug-gnu-emacs@m.gmane.org; Thu, 18 Jul 2019 01:52:08 +0200 Original-Received: from localhost ([::1]:60972 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hntiQ-0003iN-M8 for geb-bug-gnu-emacs@m.gmane.org; Wed, 17 Jul 2019 19:52:06 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:55206) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hntiN-0003iH-KA for bug-gnu-emacs@gnu.org; Wed, 17 Jul 2019 19:52:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hntiM-0002sX-Kh for bug-gnu-emacs@gnu.org; Wed, 17 Jul 2019 19:52:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:44354) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hntiM-0002sR-HW for bug-gnu-emacs@gnu.org; Wed, 17 Jul 2019 19:52:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hntiM-0005iH-EG for bug-gnu-emacs@gnu.org; Wed, 17 Jul 2019 19:52:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Noam Postavsky Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 17 Jul 2019 23:52:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 36556 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 36556-submit@debbugs.gnu.org id=B36556.156340750421938 (code B ref 36556); Wed, 17 Jul 2019 23:52:02 +0000 Original-Received: (at 36556) by debbugs.gnu.org; 17 Jul 2019 23:51:44 +0000 Original-Received: from localhost ([127.0.0.1]:53175 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hnti2-0005hj-JP for submit@debbugs.gnu.org; Wed, 17 Jul 2019 19:51:42 -0400 Original-Received: from mail-io1-f43.google.com ([209.85.166.43]:36903) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hnti0-0005hX-SJ for 36556@debbugs.gnu.org; Wed, 17 Jul 2019 19:51:41 -0400 Original-Received: by mail-io1-f43.google.com with SMTP id q22so48602277iog.4 for <36556@debbugs.gnu.org>; Wed, 17 Jul 2019 16:51:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=oHRLAnCtsbcUYeeIegwW4xAI64dZp/lkJe+DVXQUkhU=; b=JnRGvvnR0rdpvlq4ofD3k/cJnHKX7tgXdV2ExvfduDZJsAr1DG7ZAbdfw0TnF5S9mq pvvgNu/fymcF4E4IhLYDBs0DWXeBtyIcsjwgT9y6ZNT/LeP7M7jZs4ToA0nhf6AUStF1 VzjREFBTxVwfb3e/csrO/n/0T6tXDLMxuWsQG/YNH2HsZhcSPdcwX3LUb8PdWZr92Dan HuUck2nosPPIGDpJvIydUGTE2VsTX2ZZflLQEJh7pgPdGRCn4cKRWaC01GhHO5Eu6+lq i1ynSc39Rd9REIiglFIXSt+FjLzc19ZVVR4kflE3sjSllELe+W/GK4zO9piydSMSaNSl B/Ew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=oHRLAnCtsbcUYeeIegwW4xAI64dZp/lkJe+DVXQUkhU=; b=D551kEHZM4kXoW8XXSwfYxsJOMKxkaXLa9ZEcz5U5+btBdGkUVbbmczjBS+Utwzf9C Rw9k9juKVPHftg8ZtgxkSPeUsYh/ZGyRWwbLKrcbd9YQq9UQAHlRA39xNMl3topN7DVX xDoDIrl/aMgjKCyIHwYnGuY4Pw3yaPA9o3Coc40BuG1fFi7fT32SYWJjyuPWbSxCOgJX O6+QA/4vxez+RsYArvSFq15ewx8wzkLCc3gWEtUCr+oavThMOz/y9CBEid8w24QaD664 wZ9F2lipl2NbcngL1vDSRXo73lw49/gq3QPhv+xp9POpOSbq9cYXD8jlf7zXMbDr9ynK EYhA== X-Gm-Message-State: APjAAAUtN4EWBXo12uEaMLEo7IAs9o9qiVX7QkW18OoWO1jxqw4CliQi P6ahx3pcPr7dsxxNhHeT/ydMhtcK X-Google-Smtp-Source: APXvYqwePF0Gwl6CeZeBLdNik6eHyogge7hJjQ3QUTj2bBYfGZO8BQaGUu0Jn21aEHBKEVWUhijq4w== X-Received: by 2002:a02:1a86:: with SMTP id 128mr45372424jai.95.1563407494981; Wed, 17 Jul 2019 16:51:34 -0700 (PDT) Original-Received: from minid (cbl-45-2-119-34.yyz.frontiernetworks.ca. [45.2.119.34]) by smtp.gmail.com with ESMTPSA id 20sm30295704iog.62.2019.07.17.16.51.34 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 17 Jul 2019 16:51:34 -0700 (PDT) In-Reply-To: (Ken Manheimer's message of "Wed, 17 Jul 2019 15:31:34 -0400") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 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.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:163275 Archived-At: Ken Manheimer writes: >> > that `python-pdbtrack-set-tracked-buffer()` uses the wrong buffer-finding >> > function. Instead of using `get-file-buffer()`, it should be using >> > `find-buffer-visiting()`. I believe that this will solve the problem. >> >> I think this should be conditional on (or find-file-existing-other-name >> find-file-visit-truename), which is what find-file-noselect checks for. >> > > No, as far as I can tell, that doesn't hold in this situation. > > The point of this issue is to not delete a source file that was already > present in the editing session before the pdb-tracking debugging process > stepped through code in the file. The prior presence of the file should be > respected regardless of the settings of find-file-existing-other-name or > find-file-visit-truename, so these settings should not be considered for > this comparison. My understanding is that python-pdbtrack-set-tracked-buffer has to decide whether or not to (a) make a new buffer for visiting FILE-NAME (in which case pdb should kill that buffer when done with it), or (b) use an existing one (in which case, the buffer should be left open). If (or find-file-visit-truename find-file-visit-truename) is t, and FILE-NAME is visitied via an alternate name, then the current implementation will get nil from get-file-buffer, create a "new" buffer with find-file-noselect (and register that buffer in python-pdbtrack-buffers-to-kill). However, find-file-noselect will return an existing buffer, so killing this buffer is a bug (i.e., the function think it's in case (a), but it's actually in case (b)). If (or find-file-visit-truename find-file-visit-truename) is nil, then find-file-noselect would really return a new buffer in that situation, so it would be correct to kill it (i.e., with these settings, we are in case (a)). Do I have a mistake in the above?