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#66117: 30.0.50; `find-buffer-visiting' is slow when opening large number of buffers Date: Sat, 30 Dec 2023 12:10:33 +0200 Message-ID: <83frzk3srq.fsf@gnu.org> References: <878r919qfh.fsf@localhost> <83zg1d468w.fsf@gnu.org> <87bkdr2651.fsf@localhost> <87pm2584oz.fsf@localhost> <83cyy11ln1.fsf@gnu.org> <87lecp84mf.fsf@localhost> <83ttrdx8j9.fsf@gnu.org> <87a5su261p.fsf@localhost> <838r8e24yy.fsf@gnu.org> <87y1gezspg.fsf@localhost> <834jj21z05.fsf@gnu.org> <87il7izo4l.fsf@localhost> <831qe61xrh.fsf@gnu.org> <87cyxqzmhh.fsf@localhost> <83zg0uzlgw.fsf@gnu.org> <87v8bhxzcu.fsf@localhost> <83sf3te1tu.fsf@gnu.org> <87msu1qmqv.fsf@localhost> <83zfy1cgoa.fsf@gnu.org> <87le9lcg4e.fsf@localhost> <831qb578n2.fsf@gnu.org> <87zfxt3yfy.fsf@localhost> <83jzow3yf1.fsf@gnu.org> <83h6k03tpx.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="19238"; mail-complaints-to="usenet@ciao.gmane.io" Cc: dmitry@gutov.dev, 66117@debbugs.gnu.org, monnier@iro.umontreal.ca To: yantar92@posteo.net Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Dec 30 11:11:17 2023 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 1rJWJI-0004ox-Jh for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 30 Dec 2023 11:11:16 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rJWJ4-0005lg-Vw; Sat, 30 Dec 2023 05:11:03 -0500 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 1rJWJ3-0005lV-Ri for bug-gnu-emacs@gnu.org; Sat, 30 Dec 2023 05:11:01 -0500 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 1rJWJ3-0006Xq-J6 for bug-gnu-emacs@gnu.org; Sat, 30 Dec 2023 05:11:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rJWJ3-00089Z-Vs for bug-gnu-emacs@gnu.org; Sat, 30 Dec 2023 05:11:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 30 Dec 2023 10:11:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 66117 X-GNU-PR-Package: emacs Original-Received: via spool by 66117-submit@debbugs.gnu.org id=B66117.170393105231324 (code B ref 66117); Sat, 30 Dec 2023 10:11:01 +0000 Original-Received: (at 66117) by debbugs.gnu.org; 30 Dec 2023 10:10:52 +0000 Original-Received: from localhost ([127.0.0.1]:43067 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rJWIt-000899-PJ for submit@debbugs.gnu.org; Sat, 30 Dec 2023 05:10:52 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:52518) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rJWIr-00088w-LH for 66117@debbugs.gnu.org; Sat, 30 Dec 2023 05:10:50 -0500 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 1rJWIl-0006Us-4R; Sat, 30 Dec 2023 05:10:43 -0500 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=bg3znW2K6a8d8bcMBu8K56kOZYefxvB/yW5Qaiefw/M=; b=HfdAKE+StDyR tserZPap+4MKt9LsvAGXELE/WWnvbfvG+CGmox5ELm7rRvCdG43jjLzpSuX2ZbBhz6uUiYj/0iJSQ 8QdFJWFmMUzb1RmXIAzlQoGdPUHPI/3K5GVdIwBoySqm+yrMmTHCi58s2cIZElNlrjuuIJ+YN4loA Un6+oRc749CiAPg1Tey9Dbl9G1+JYqJ8fCYOPMV/B45js2gpirMVWaRMaVXNL2rkJ7+wERhrQU9YX YP4K4bZ03sWaW9ZNiabm/m2lYLG7Itwz1kbyU+3Gh9/bhdFRPikEKX+xcV7emNF91BjlEjSa5XFdR 1X9WfKiVSdxz5ltJpK/HSQ==; In-Reply-To: <83h6k03tpx.fsf@gnu.org> (message from Eli Zaretskii on Sat, 30 Dec 2023 11:50:02 +0200) 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:277071 Archived-At: > Cc: dmitry@gutov.dev, 66117@debbugs.gnu.org, monnier@iro.umontreal.ca > Date: Sat, 30 Dec 2023 11:50:02 +0200 > From: Eli Zaretskii > > > Cc: dmitry@gutov.dev, 66117@debbugs.gnu.org, monnier@iro.umontreal.ca > > Date: Sat, 30 Dec 2023 10:08:34 +0200 > > From: Eli Zaretskii > > > > > From: Ihor Radchenko > > > Cc: monnier@iro.umontreal.ca, dmitry@gutov.dev, 66117@debbugs.gnu.org > > > Date: Fri, 29 Dec 2023 13:55:45 +0000 > > > > > > Eli Zaretskii writes: > > > > > > >> No. I just had a problem with my local git repo. git reset fixed it and > > > >> revealed that the patch is indeed not installed yet. > > > > > > > > Is that patch still valid, or do you need to rebase it? Would you > > > > like to repost it? > > > > > > All the three patches I submitted in this thread are cleanly applying > > > onto freshly cloned master. > > > > Thanks, I installed them. > > > > Should we now close this bug? > > Ehmm... I see that test/src/buffer-tests now have 5 failures that > were not there before: > > 5 unexpected results: > FAILED test-buffer-modifications > FAILED test-kill-buffer-auto-save-default > FAILED test-kill-buffer-auto-save-delete-no > FAILED test-kill-buffer-auto-save-delete-yes > FAILED test-restore-buffer-modified-p > > Also, 7 of the lisp/files-test fail: > > 7 unexpected results: > FAILED files-tests-bug-18141 > FAILED files-tests-file-name-non-special-make-auto-save-file-name > FAILED files-tests-file-name-non-special-set-visited-file-modtime > FAILED files-tests-no-file-write-contents > FAILED files-tests-revert-buffer > FAILED files-tests-revert-buffer-with-fine-grain > FAILED files-tests-zzdont-rewrite-precious-files > > Could you please look into these? (Interestingly, those 5+7 don't > fail for me on MS-Windows, only on GNU/Linux...) I think at least part of the problem is in this fragment from find-file-noselect: ;; Find any buffer for a file that has same truename. (other (and (not buf) (find-buffer-visiting filename ;; We want to filter out buffers that we've ;; visited via symlinks and the like, where ;; the symlink no longer exists. (lambda (buffer) (let ((file (buffer-local-value 'buffer-file-name buffer))) (and file (file-exists-p file)))))))) This call to find-buffer-visiting fails because file-exists-p is called with a nil argument: Test test-buffer-modifications backtrace: file-exists-p(nil) find-buffer-visiting("/tmp/emacs-test-MzitxT-buffer" #f(compiled-fun find-file-noselect("/tmp/emacs-test-MzitxT-buffer" nil nil nil) find-file("/tmp/emacs-test-MzitxT-buffer") Please attend to this as soon as you can, because I think this same problem will break many other use cases. (I guess this doesn't happen on Windows because the involved files/directories are not symlinks.)