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#75209: 30.0.93; Emacs reader failed to read data in "/home/nlj/.cache/org-persist/gc-lock.eld" Date: Sun, 05 Jan 2025 13:15:32 +0200 Message-ID: <86ldvp8qaz.fsf@gnu.org> References: <878qrxgg74.fsf@Phoenix> <864j2lnf1j.fsf@gnu.org> <87ldvvhhqo.fsf@localhost> <87frm3elkr.fsf@Phoenix> <878qrvhe0k.fsf@localhost> <86v7uzljc5.fsf@gnu.org> <87ldvug9a3.fsf@localhost> <86ttailoi9.fsf@gnu.org> <87y0ztqg65.fsf@localhost> <86y0zthx11.fsf@gnu.org> <87pll1pofu.fsf@localhost> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="14594"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 75209@debbugs.gnu.org, njackson@posteo.net To: Ihor Radchenko Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Jan 05 12:16:17 2025 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 1tUOcC-0003er-Qj for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 05 Jan 2025 12:16:17 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tUOc1-0007lY-9j; Sun, 05 Jan 2025 06:16:05 -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 1tUObz-0007l3-1H for bug-gnu-emacs@gnu.org; Sun, 05 Jan 2025 06:16:03 -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 1tUOby-0000mz-Oz for bug-gnu-emacs@gnu.org; Sun, 05 Jan 2025 06:16:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=References:In-Reply-To:From:Date:To:Subject; bh=VItwdIwNUK+tOYhSj7PhnUZYhyNesEgYQESufXuAtL0=; b=tSj/OX/QXBQYC119PfwG5igdch48/PMOp0Pev/zQCuflrXPf0+3s9SjhLUQfNbJzjCJA/H5eEcmBu1mLsNgduM00/L9lwgwcL/KAnRWC5f0NhwPxjocvtICLKTRbojcN/Vh9AkztDyfZTu73SHwg2IrK2aPlHfphEGZOjKtuaH1D/orKxZtGNR9uyQBColN05FzCOtp/rYR9qIIjw+Jkfu/+/Eln9u/XRacNooB3HDlV3EySbEo3SmzmxwVgXrc51yANDSumPPLw0Y0nKOvR1qVMF7J844d1PzEuhMHh6E5KTbORHzsx5zBRoutMtlEqfqdCi8s2okdB2vXjVoaF+Q==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tUObx-0004Ku-Od for bug-gnu-emacs@gnu.org; Sun, 05 Jan 2025 06:16:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 05 Jan 2025 11:16:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 75209 X-GNU-PR-Package: emacs Original-Received: via spool by 75209-submit@debbugs.gnu.org id=B75209.173607574416636 (code B ref 75209); Sun, 05 Jan 2025 11:16:01 +0000 Original-Received: (at 75209) by debbugs.gnu.org; 5 Jan 2025 11:15:44 +0000 Original-Received: from localhost ([127.0.0.1]:60122 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tUObf-0004KG-Qa for submit@debbugs.gnu.org; Sun, 05 Jan 2025 06:15:44 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:44080) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tUObe-0004Jy-4O for 75209@debbugs.gnu.org; Sun, 05 Jan 2025 06:15:43 -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 1tUObW-0008KF-2I; Sun, 05 Jan 2025 06:15:34 -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=VItwdIwNUK+tOYhSj7PhnUZYhyNesEgYQESufXuAtL0=; b=Birzm0nR+OdO 8M+aZseb9LcKysls4KnfwwzU0pBSooM5SVv9UKk3hHGve1GkEWi9M2FA0nlQ+7RjbkraXvnOUt7kq zneJ3LkG4+r0+8rUSW0VPEJ/LGaFhlo7iMF5EgPPhqzLww9HVLR9S0exv5XHT7D/yNuh9VlPvmUm3 brwYbWS8U/w8Mvc3GAQvKnS2Ofvdb+Y1ThZFMiprAMaTYGpFEa8OVgbXMcUKQCLBBqRfRZrHzlTVX DSsAadO5kmx2F0rJ1abQBFhxSHRzC6Qs3545X4hPaLZzbwG1EqwNhmYUYYdvvMp5WfC4BBcklJsT+ yr/v1rHMll+5gHuAlc7KTA==; In-Reply-To: <87pll1pofu.fsf@localhost> (message from Ihor Radchenko on Sun, 05 Jan 2025 10:03:49 +0000) 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:298537 Archived-At: > From: Ihor Radchenko > Cc: njackson@posteo.net, 75209@debbugs.gnu.org > Date: Sun, 05 Jan 2025 10:03:49 +0000 > > > And if the cache is common to all sessions, then perhaps reading the > > index before writing it should avoid several sessions step on each > > other's toes? > > You are right. The only problem is short-living caches that should be > cleared at the end of Emacs session that created it. Does this mean you have ideas for solving this problem by reading the file before it is written? Or does this mean you already read the file before writing to it? > > One way of rewriting a file atomically is to write the stuff to a > > temporary file, then rename it to the target name. If Org doesn't > > already do that, maybe you should try doing that (together with > > reading the file before updating it)? > > Org uses `with-temp-file'. Is there an alternative built-in and more > robust way to write string to file? Writing to a file is not atomic. If you instead write to a temporary file, then rename it to the final file name, the renaming is atomic on Posix filesystems. This would mean you can still use with-temp-file, but with a temporary file name as its argument, and you need to add a single rename-file call afterwards.